I have a Web Forms .NET 4.5+ application running on an Azure VM web server (Windows Server 2019) using IIS 8.
The site will load with an index.html page in production (In other words, the web server connection is good LIVE, without a DB connection). The site fully loads locally, database included (Locally means running the site through Visual Studio 2019 / Chrome on my desktop)
My web.config
is the same locally as it is in prod -> it has the same connection string, etc.
My SQL database is not on a traditional SQL Server instance, through a VM on a server. It is technically an "Azure SQL DB"
The problem, and error: when I enter the site URL, the page times-out and fails to connect to the SQL Server/DB. Here is the full error text:
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 have added an inbound AND outbound rule to my firewall for Port 1433
- I have a valid login for my connectionString (again, the same SQL connection works locally
- Again, the site loads without any attempt at a DB connection
- I have attempted a "dumbed-down" version of the connection string (full string seen below). Meaning, removed certain qualifiers and flags. Tried different combinations
Here's the full connection string that Azure provides. This is what I'm using:
Server=tcp:dbservername.database.windows.net,1433;Initial Catalog=D2Items_DB;
Persist Security Info=False;User ID=myUserName;Password=myPassword;
MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;
Excess/redundant information:
- Entering the website's IP address or URL in my web browser is what fails
- It does NOT fail when I am NOT making a database connection (example: When index.html is the ONLY file in the web site's folder on the server)
- This is my first time deploying/publishing a web app to a public domain. I have 5-6 years of .NET full-stack experience, but I have always worked on intranet only, and on pre-configured servers. I chose Azure because it was free with a trial. I thought it would be easy. I was wrong. I'm considering other options.