简体   繁体   中英

SQL SERVER ERROR (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)

I'm working on a website using ASP.NET, C# and mssql. When I run the website on our local server it is working fine.

The following error occurs when I run it on a shared server:

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)

I don't know how to play with connection string now since I'm very new to this.

It is recommend to keep the connection string in web.config. To create a valid connection string with SQL Server (either located on network or locally), use following steps:

Steps:

  1. Create a Test.UDL file at your desktop.
  2. Double click the file to see undermentioned Data Link Properties
  3. Select provider ie SQL Server in your case
  4. Provide connection details ie server, username, password etc. in Connection tab.
  5. Test Connection on connection tab and press "OK".
  6. Open UDL file in notepad to see valid connection string.

在此处输入图片说明

UPDATE

check following link for creating UDL http://msdn.microsoft.com/en-us/library/e38h511e(v=vs.71).aspx

check following link for connection string Setting up connection string in ASP.NET to SQL SERVER

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM