我在 WEBSERVER 上托管我的 ASP.NET 网站..但是当我尝试访问我的网站时上传后......
http://www.vbi.volvobusesindia.com
然后出现如下错误....
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)
我已将 web.config 文件和所有网页中的连接字符串更改为:
<connectionStrings>
<remove name="ConnectionString"/>
<add name="ConnectionString" connectionString="Data Source=69.16.253.19,1433; Network Library=DBMSSOCN; Initial Catalog=database;Persist Security Info=True;User ID=username;Password=password" providerName="System.Data.SqlClient"/>
</connectionStrings>
...在发布和上传我的网站到网络服务器之前...
我很困惑问题是来 self 的本地计算机还是网络服务器....以及如何修复此错误?
最佳答案
这意味着您的网络服务器无法连接到 SQL 服务器。您确定 IP 正确,并且 SQL 服务器配置为接受通过 IP 的远程连接吗?
您能否使用 SQL Management Studio 连接到数据库服务器,使用与连接字符串中相同的用户名、密码和 IP 地址?您的应用程序是否从 web.config 检索正确的连接字符串?
关于asp.net - 建立与 SQL Server 的连接时出现与网络相关或特定于实例的错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4737948/