与 SQL Server 建立连接时发生网络相关或特定于实例的错误

发布于 2024-10-13 00:03:36 字数 882 浏览 7 评论 0原文

我在网络服务器上托管我的 ASP.NET 网站..但是上传后,当我尝试访问我的网站时...

http:// /www.vbi.volvobusesindia.com

然后出现以下错误....

与网络相关或特定于实例的 建立时发生错误 连接到 SQL Server。服务器 未找到或无法访问。 验证实例名称是否为 正确并且 SQL Server 是 配置为允许远程 连接。 (提供商:SQL 网络 接口,错误:26 - 错误定位 指定服务器/实例)

我已将 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>

...在将我的网站发布和上传到网络服务器之前...

我很困惑问题来自我的本地计算机或网络服务器......以及如何修复此错误?

I HOST MY ASP.NET WEBSITE ON WEBSERVER ..But after upload when i try to access my site ...

http://www.vbi.volvobusesindia.com

Then following error occurs ....

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 have changed my connectionstring in web.config file and all webpages to :

<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>

...before publishing and uploading my website to webserver ...

I m confused the problem is from my local computer or the webserver ....and how to fix this error ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

最丧也最甜 2024-10-20 00:03:36

这意味着您的 Web 服务器无法连接到 SQL 服务器。您确定 IP 正确,并且 SQL Server 配置为接受通过 IP 的远程连接吗?

您能否使用 SQL Management Studio 连接到数据库服务器,并使用连接字符串中的相同用户名、密码和 IP 地址?您的应用程序是否从 web.config 检索了正确的连接字符串?

This means that your web server can't connect talk to the SQL server. Are you sure that the IP is correct, and that the SQL server is configured to accept remote connections over IP?

Can you connect to the database server using SQL Management Studio, using the same username, password and IP address that are in your connection string? Is your application retrieving the correct connection string from web.config?

放飞的风筝 2024-10-20 00:03:36

ASP.NET 无法连接到您的数据库 - 地址错误,或者 SQL Server 未配置为接受远程 TCP/IP 连接,或者(可能更有可能)中间有防火墙阻止流量获取通过...

ASP.NET can't connect to your database - either the address is wrong, or the SQL Server isn't configured to accept remote TCP/IP connections, or (probably more likely) there's a firewall in between that's stopping the traffic from getting through...

口干舌燥 2024-10-20 00:03:36

不确定,但可能是这样的: Data Source=69.16.253.19,1433 。如果 1433 是您尝试使用的端口,请写入:.69.16.253.19:1433

Not sure but might be this: Data Source=69.16.253.19,1433 . If 1433 is the port you are trying to use, write it with a : .69.16.253.19:1433

尛丟丟 2024-10-20 00:03:36

在他们关闭之前我在你的其他帖子上看到了它可能是解决你的问题的关键。我注意到您的服务器说找不到“C:\Users\Ashis...”

在我看来,您的服务器正在使用客户端代码来获取数据库的路径。因此,浏览器始终在“客户端”计算机上查找。

您需要使用服务器端脚本,例如 Server.MapPath("mydbname") (c# 语法)来获取数据库的路径。

I saw on you other post before they closed it that may have held the key to your problem. I noticed your server was saying cannot find "C:\Users\Ashis..."

It looks to me like your server is using client side code to get the path to the database. Therefore the browser is always looking on the "clients" machine.

You need to use server side script, something like Server.MapPath("mydbname") (c# syntax) to get path of the database.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文