Click here to Skip to main content
15,892,480 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have hosted my application on a server and also purchased space on web server.But I am not able to try to connect with my database. And using SQL server management studio 2008 I can easily connect and access my database
Every time I get this error:
A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)
My connection string string I am using is given below:
connectionString="Server=***.**.***.***;Initial Catalog=xyz;User ID=abcd;Password=abcd"

I have interacted with hosting provider as they are using some port number or instance name but they say no. They told me that all connection are open at port 1433.
Then I tried with this connection string:
connectionString="Server=***.**.***.***,1433;Initial Catalog=xyz;User ID=abcd;Password=abcd"

But same error/exception.
Posted
Updated 12-Mar-12 0:23am
v2

check these things
1. Make sure your database engine is configured to accept remote connections(I you are using centralized database)
•Start > All Programs > SQL Server 2005 > Configuration Tools > SQL Server Surface Area Configuration
•Click on Surface Area Configuration for Services and Connections
•Select the instance that is having a problem > Database Engine > Remote Connections
•Enable local and remote connections
•Restart instance

2. Check the SQL Server service account
•If you are not using a domain account as a service account (for example if you are using NETWORK SERVICE), you may want to switch this first before proceeding

3.If you are using a named SQL Server instance, make sure you are using that instance name in your connection strings in your ASweb P.NET application
•Usually the format needed to specify the database server is machinename\instancename
•Check your connection string as well


or

you can try these steps
For connectivity in visual studio 
open Server Explorer
right click add Connection
Follow simple steps
After Creating Connection Right click on Database//Solve error if any
Click on properties
In Proprties Connection String will be found.
Copy This String.
 
Share this answer
 
 
Share this answer
 
Completely agree with Uma Shankar Patel's solution. But still if you have the same problem please try selecting Using both TCP/IP and named pipes under Remote Connections.

restart the service and check. And also check any port setting in firewall.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900