9
votes

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.

2
What version of Visual Studio are you using when you try to do remote debugging? Also, you may want to consider adding Application Insights to your web app.Rick Rainey
I am using VS 2015 RC. It says that it is not supported.Jonas Arcangel
I just found from the detailed errors XML that it is caused by MapRequestHandler. No other details were provided.Jonas Arcangel
Yeah, that's just going to tell you where in the asp.net pipeline the error occurred. To get details from your application, you need some diagnostics logging in your application. Or, remote debug it but as you say it's not supported in VS2015 yet. Application Insights is really useful but I've not tried it with VS2015. One thing you can do without making any change to your code is install the Diagnostics as a service extension to your web app. Reproduce the error and then run the extension & look at the memory dump analysis. It will show you the call-stack and the exception msg. from your appRick Rainey
The error is because my Authentication AppId and AppSecret needs to be installed separately on the server. Apparently just copying the config.json file doesn't work. I don't know how to do set this up yet. I have posted a new question about this. stackoverflow.com/questions/30438382/…Jonas Arcangel

2 Answers

2
votes

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.

1
votes

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.