Reputation: 63
I have written a C# desktop (winforms) application which is essentially a clone of a web application I wrote. The web application is able to talk back and forth with the database just fine. However, when I install the desktop application, I get the following error:
A network-related or instance-specific error occurred while establishing a connection to SQL Server
I am using the exact same connection string in the desktop application as I am using in the web app which looks like this:
"Data Source=tcp:s08.winhost.com;Initial Catalog=THEDATABASE;
User ID=USERNAME;Password=******;Integrated Security=False;"
I am unable to use SQL Server Configuration Manager as my databases are hosted on Winhost.com. However they have made it clear to me that the proper ports are open, named pipes are on and SQL Browser is configured correctly. If anyone has had a similar problem, please let me know what you did to resolve this issue. I have also included the entire error below.
Thanks
************** 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
Upvotes: 1
Views: 2926
Reputation: 63
Eventually I found that the problem was a proxy server. The application is being used by corporations who have proxy servers setup and due to this port 1433 was blocked. I ended up resolving the issue by creating a webservice.
Upvotes: 0
Reputation: 3850
Remove TCP protocol name and port number and try with full hosting website address..something like this
Data Source=www.winhost.com;Initial Catalog=THEDATABASE;
User ID=USERNAME;Password=**;Integrated Security=False;
Upvotes: 1