Sql-server – Unable to connect to SQL Server on live server

iissql serversql-server-2014

I have a copy of my client's database and website on my computer. There's also a matching copy of both online where my client's customers will use the website.

When I test my local copy of the website with my local database, everything works.
When I test my local copy of the website with the online database, everything works fine.

When I test the online copy of the website with the online database, I get the following error:

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've been working with the webhost for more than 12 hours now and we've managed to verify that I am using the correct instance name.

He's very cautious so he doesn't allow remote connections, however, as the website and SQL Server both exist on the same server, I don't think this would be the problem.

I'm 99% sure the problem is that, since I'm using what we know to be the correct instance name for SQL Server, the problem has got to be communication into SQL. I feel like there's something the webhost has set that is blocking or rejecting requests made to SQL Server.

Can anyone suggest any causes for this error? I googled it but didn't find any information that was particularly enlightening – which is to say that all of the information I found covered things I've already checked.

EDIT

I'm now also unable to connect remotely with Management Studio because

Login failed for user

I have verified that my credentials are correct.

Best Answer

Since you stated that the application runs correctly from your machine, you could test the following:

  • Check if changing the connection string to work with local IP instead of hostname works
  • Check if the application pool user on your local machine == the application pool user on the IIS
  • Ping the hostname from the server to see if it resolves correctly
  • If using windows authentication, make sure you're not using basic authentication

A quick way to test SQL Server connections directly is by creating udl files, if your web host is willing you could do a remotion session and test some different configurations using a udl file.