Please help me solve this issue once I am trying to deploy my website on Azure while my ASP_ENVIRONMENT
set to Production
still getting this issue. Please help me solve my deployment on Azure step by step
Asked
Active
Viewed 461 times
0

marc_s
- 732,580
- 175
- 1,330
- 1,459

Anunay Kumar
- 19
- 6
-
Go to Azure, click on your Web App –> "Applications Settings" –> go down to the “App Settings” section and add the “ASPNETCORE_ENVIRONMENT” and “Development”, you can see the specific error message. Please refer to this link: [Error after deploying asp.net core app to azure](https://stackoverflow.com/a/46413899/18789859). – Chen Feb 16 '23 at 06:03
-
After doing the same now I am getting error like "SqlException: 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: SNI_PN11, error: 26 - Error Locating Server/Instance Specified)" – Anunay Kumar Feb 16 '23 at 08:16
-
mine Connection string was ""DbConnection": "Data Source=HDLCAMPUS6275\\SQLEXPRESS;Initial Catalog=FoodHub;Persist Security Info=True;User ID=sa;Password=Anunay@123;encrypt=true;TrustServerCertificate=True;Max Pool Size=100"}, – Anunay Kumar Feb 16 '23 at 08:17
-
This error usually means that the client can't find the SQL Server instance. Please check this document: [A network-related or instance-specific error occurred while establishing a connection to SQL Server](https://learn.microsoft.com/en-us/troubleshoot/sql/database-engine/connect/network-related-or-instance-specific-error-occurred-while-establishing-connection). – Chen Feb 16 '23 at 09:32
-
In service dependencies I successfully established the secure connection with On-premises SQL server connection I got this error now after publishing "InvalidOperationException: Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled connections were in use and max pool size was reached." – Anunay Kumar Feb 16 '23 at 17:35
1 Answers
1
HDLCAMPUS6275\\SQLEXPRESS
is on-premise sql server, that's why you get this issue.
If you have the public ip, you could change the connectionstring like blow.
Data Source=public_ip,1433;Initial Catalog=FoodHub;Persist Security Info=True;User ID=sa;Password=Anunay@123;encrypt=true;TrustServerCertificate=True;Max Pool Size=100
You should test it in your local by using the sql server management studio(SSMS).
Related docs:
1. How to configure SQL Express 2012 to accept remote connections
2. Generate or find Connection String from Visual Studio
3. If you don't have public ip, you could use ngrok for test
Then your should be fixed.

Jason Pan
- 15,263
- 1
- 14
- 29