简体   繁体   中英

internal server error (500) after publishing a project to Azure

I can't seem to find an answer to my question from previous posts.. I built a project using Angular.ts for the client side and .NET CORE for the server side development, and SSMS for developing the DB. everything works fine while I run the project on my local host, but when I tried to publish the project to Azure, it seems as if the whole server side doesn't work. when I open the console an error pops up saying the server responded with a status of 500. error:

Failed to load resource: the server responded with a status of 500 (Internal Server Error)

in azure I created a resource group, an SQL server, I have created an SQL Database in azure and used query editor to run all of the tables I had in my DB from SSMS. (because it seems that there is no way to run the entire db using query editor and it says it doesn't suppors the USE command so i generated a script for every table in my db and connected all of them one by one..) then, I created an App service.

in visual studio code I used ng build --aot --prod to generate a "dist" folder with all of the client side files and copied them to "wwwroot" folder in visual studio.

I have copied the ADO.NET connection string from azure connection strings section and placed it in my "appsettings.production.json"

when I hit publish the project runs and publish returns no errors but in the browser's (chrome) console i get the error I described.

if i try to load one of my api urls it says:

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: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)

anyone knows why this kind of problem can occur?...

Sometimes this can happen because of the IP restrictions within your Azure SQL instance.

To get around this, get the Outbound IP Addresses of your app service: 在此处输入图像描述

Head to your SQL instance and adjust your IP-Level firewall rules to allow the IPs listed within your App Service's "Outbound IP Addresses":

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM