我编写了一个 C# 桌面(winforms)应用程序,它本质上是我编写的 Web 应用程序的克隆。Web 应用程序能够很好地与数据库来回通信。但是,当我安装桌面应用程序时,出现以下错误:
与 SQL Server 建立连接时发生与网络相关或特定于实例的错误
我在桌面应用程序中使用与在 Web 应用程序中使用的完全相同的连接字符串,如下所示:
"Data Source=tcp:s08.winhost.com;Initial Catalog=THEDATABASE;
User ID=USERNAME;Password=******;Integrated Security=False;"
我无法使用 SQL Server 配置管理器,因为我的数据库托管在 Winhost.com 上。但是,他们已经向我明确表示,正确的端口已打开,命名管道已打开,并且 SQL 浏览器已正确配置。如果有人遇到过类似的问题,请告诉我您为解决此问题所做的工作。我还在下面包含了整个错误。
谢谢
************** Exception Text **************
System.Data.SqlClient.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: TCP Provider, error: 0 - A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.) ---> System.ComponentModel.Win32Exception (0x80004005): A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond