Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Azure connection string exception "network-related orinstance-specific error occurred"

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:

  • Problem while connecting to cloud database
  • SQL Azure : Connection to SQL Azure throws exception

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

like image 443
ahsteele Avatar asked Nov 04 '22 21:11

ahsteele


1 Answers

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.

like image 55
ahsteele Avatar answered Nov 09 '22 03:11

ahsteele