简体   繁体   English

SQL服务器错误(提供程序:SQL网络接口,错误:26-错误指定服务器/实例的位置)

[英]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. 我正在使用ASP.NET,C#和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. 建立与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. 验证实例名称正确,并且已将SQL Server配置为允许远程连接。 (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified) (提供者:SQL网络接口,错误:26-指定服务器/实例时出错)

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. 建议将连接字符串保留在web.config中。 To create a valid connection string with SQL Server (either located on network or locally), use following steps: 若要使用SQL Server(位于网络上或本地)创建有效的连接字符串,请使用以下步骤:

Steps: 脚步:

  1. Create a Test.UDL file at your desktop. 在您的桌面上创建一个Test.UDL文件。
  2. Double click the file to see undermentioned Data Link Properties 双击文件以查看下面提到的数据链接属性
  3. Select provider ie SQL Server in your case 选择提供程序,例如您的SQL Server
  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. 在记事本中打开UDL文件以查看有效的连接字符串。

在此处输入图片说明

UPDATE 更新

check following link for creating UDL http://msdn.microsoft.com/en-us/library/e38h511e(v=vs.71).aspx 检查以下用于创建UDL的链接http://msdn.microsoft.com/zh-cn/library/e38h511e(v=vs.71).aspx

check following link for connection string Setting up connection string in ASP.NET to SQL SERVER 检查连接字符串的以下链接: 在ASP.NET中设置与SQL SERVER的连接字符串

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 脚手架后的迁移问题。 (提供者:SQL 网络接口,错误:26 - 错误定位服务器/指定的实例) - Migration issue after scafolding. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified) 在我的VM上:SQL网络接口,错误:26-查找指定的服务器/实例时出错 - on my VM: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified 连接数据库ASP .NET MVC 5 SQL网络接口时出现问题,错误:26-指定服务器/实例时出错 - Issue connecting to databases ASP .NET MVC 5 SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified SQL网络接口,错误:26-定位本地数据库上指定的服务器/实例时出错 - SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified on LocalDB SQL Server:无法从本地网站连接(SQL网络接口,错误:26-指定服务器/实例时出错) - SQL Server: cannot connect from local website (SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified) .NET Core WebAPI 应用程序在本地连接,但在服务器上失败,并出现 SQL 网络接口错误:26 定位服务器/指定实例时出错 - .NET Core WebAPI app connects locally but fails on the Server with SQL Network Interfaces error: 26 Error Locating Server/Instance Specified SQL错误:26-查找指定的服务器/实例时出错 - SQL error:26 - Error Locating Server/Instance Specified 使用C#的SQL上的错误26,指定了错误定位服务器/实例 - Error 26 on SQL with C#, error locating server / instance specified 仅在调试时才出现SQL Server错误26(指定错误的服务器/实例) - SQL Server Error 26 (Error Locating Server/Instance Specified) Only When Debugging SQL Server Compact Edition 4.0:错误:26 - 找到指定的服务器/实例时出错 - SQL Server Compact Edition 4.0: Error: 26 - Error Locating Server/Instance Specified
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM