samedi 1 août 2015

(Could not open a connection to SQL Server) Error when connecting to remote database from asp.net web application hosted on GoDaddy

I'm getting the following error, while trying to connect to a remote database (on other web hosting server) from my asp.net web app hosted on GoDaddy:

[Win32Exception (0x80004005): The network path was not found]

[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: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)]
System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) +5347119

While working locally and running the asp.net through visual studio, connection to the remote database worked fine. But when I published the application to the GoDaddy server, I received the above error.

Connection String:

<add name="Connection2" connectionString="Server=103.21.58.192;Database=databaseName;Uid=user;Password=password;MultipleActiveResultSets=true" providerName="System.Data.SqlClient"/>

Aucun commentaire:

Enregistrer un commentaire