I have an MVC 6 site that has been deployed as an Azure Web App. I have enabled all tracing / diagnostic options in Visual Studio using Server Explorer. I am trying to do remote debugging, but I am only seeing an Error 500 on my browser, and not finding any information (or triggering an error breakpoint) on where exactly the error occurred.
I can't find any error trace on the file logs that I get from Azure.
How should I troubleshoot Error 500's in an Azure Web App?
Adding "CustomErrors": {"Mode": "Off"} to config.json didn't work.
To view the actual error message description, in IIS Manager, expand the server node, expand Sites, select Default Web Site, and in the IIS section, double-click the Error Pages icon. The list of error codes and related IIS error pages are displayed. Right-click 500, and then click Edit Feature Settings.
Log detailed errors To save the error page or failed request tracing for Windows apps in the Azure portal, navigate to your app and select App Service logs. Under Detailed Error Logging or Failed Request Tracing, select On, then select Save. Both types of logs are stored in the App Service file system.
For MVC 6 you need to add a web.config file to the wwwroot folder with the following:
<configuration>
<system.web>
<customErrors mode="Off"/>
</system.web>
</configuration>
That will add the markup to the deployed web.config file, and give you detailed errors. See http://docs.asp.net/en/latest/fundamentals/diagnostics.html#http-500-errors-on-azure for more details.
First, you have to enable LOG files on Azure.
In MVC Core you do that by setting stdoutLogsEnabled=true in web.config -> ->
Then you go to Azure App Service console, Click on Diagnostics Logs under MONITORING Category.
There you have FTP link, where you have your LOG files stored.
Open it and you will see a detailed error. Dont forget to stop your App Service Server before you try to open LOG file, otherwise it won't be accessible.
Hope that helps you.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With