5

When attempting to connect to SQL Azure with the following connection string

Server=tcp:SERVER.database.windows.net,1433;Database=DBNAME;User ID=USER@SERVER;Password=PASSWORD;Trusted_Connection=False;Encrypt=True

from a locally running ASP.NET MVC application I receive this exception:

{"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 - No such host is known.)"}

I realize this is a relatively generic error message.

In troubleshooting the problem I have opened inbound and outbound traffic through my Windows firewall on port 1433:

netsh advfirewall firewall add rule name=”Open Port 80” dir=in action=allow protocol=TCP localport=80

I have configured the Azure firewall to accept connections from my IP address as well to "Allow other Windows Azure services to access this server." I can connect to the Azure database via SQL Server Management Studio 2008 R2. I cannot telnet to the database via

telnet SERVER.database.windows.net 1433

Related Stack Overflow Questions:

I feel like I must be overlooking something basic. Are there other troubleshooting steps I have missed?

Community
  • 1
  • 1
ahsteele
  • 26,243
  • 28
  • 134
  • 248
  • You checked the information available on [MSDN](http://msdn.microsoft.com/en-us/library/gg465380.aspx)? – DOK Jun 02 '11 at 08:34
  • @DOK I've looked through a lot of the information on MSDN, the article you are specifically referencing seems to be about Azure services and not SQL-Azure, am I missing something? – ahsteele Jun 02 '11 at 13:02
  • @Aaronontheweb tried switching to encrypted=False, didn't make a difference. :( – ahsteele Jun 02 '11 at 13:02
  • Do you have a proxy between you and web? I have seen that some proxies block TCP traffic that is not running as the user. Since web sites run as app pool identity, it gets blocked sometimes. – dunnry Jun 02 '11 at 15:49
  • also, if you have a proxy, TCP proxy may have a different IP address than your HTTP proxy. Make sure that SQL Azure has the correct IP address in its firewall – Igorek Jun 02 '11 at 19:09
  • @lgorek I don't have a proxy configured and I "confirmed" that my internet provider is not shimming one in without my knowledge via the Lagado proxy test: http://www.lagado.com/proxy-test. – ahsteele Jun 02 '11 at 23:10

1 Answers1

2

Embarrassed to say that that this issue was caused because I fat fingered the server name. Apparently, I really am terrible at solitary programming these days. Thank you to all of the comments above which caused me to keep asking myself what am I missing.

ahsteele
  • 26,243
  • 28
  • 134
  • 248
  • It's always the server name, I faced the same issue few times. Since Azure db's have complex names, it can go wrong in many ways like mistyping, copying part of it etc. – Dhanuka777 Jun 26 '15 at 06:19