Click here to Skip to main content
15,899,313 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Server Error in '/' Application.
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)
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: 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)

Source Error:
[No relevant source lines]

Source File: App_Code.8ojkszie.1.cs    Line: 21

Stack Trace:
[SqlException (0x80131904): 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 web.config is:

XML
<configuration>
  <connectionstrings>
    <add name="myConnectionString" connectionstring="Data Source=mydatasource.db.11311029.myresource.com; Initial Catalog=test; User ID=test; Password='test'; ">
     providerName="System.Data.SqlClient" /&gt;


  </add></connectionstrings>
 <system.web>
        <compilation debug="true" targetframework="4.0" />
   <anonymousidentification enabled="true" />
   <profile enabled="true">
     <properties>
       <add name="SCart" serializeas="Binary" type="ShoppingCartExample.Cart" allowanonymous="true" />
     </properties>
   </profile>
<authorization>
     <allow users="?" />
     <allow roles="admin" />
   </authorization>
   <rolemanager enabled="true" />
   <authentication mode="Forms" />
   <customerrors mode="Off" />
    </system.web>
</configuration>
Posted
Updated 9-Jul-13 10:49am
v3
Comments
maneavnash 9-Jul-13 10:40am    
check whether host server having sq l-server or not
means did u plan that contain sq l-server database or not
[no name] 9-Jul-13 10:54am    
Check your connection string
ZurdoDev 9-Jul-13 12:32pm    
This means your connection string is wrong.

1 solution

As maneavnash, ThePhantomUpvoter and ryanb31 have mentioned the connection string is wrong:
Data Source=mydatasource.db.11311029.myresource.com


Have a look here: http://www.connectionstrings.com/sql-server-2008/[^] - section: Connect via an IP address.

Quote:
DBMSSOCN=TCP/IP is how to use TCP/IP instead of Named Pipes. At the end of the Data Source is the port to use. 1433 is the default port for SQL Server. Read more here[^]


More:
How to: Configure a Server to Listen on an Alternate Pipe (SQL Server Configuration Manager)[^]
How to: Configure a Server to Listen on a Specific TCP Port (SQL Server Configuration Manager)[^]
How to: Configure a Windows Firewall for Database Engine Access[^]
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 9-Jul-13 17:46pm    
Good points, 5ed.
—SA
Maciej Los 9-Jul-13 17:48pm    
Thank you, Sergey ;)

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



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