If you have done much Asp.Net Core development and publishing to Azure App Service, you may at some point have hit the following error in the browser:
HTTP 502.5 - Process Failure
Something is going badly wrong. What's more is that this happens before any of the normal logging can start up.
To find out what's going on, you need to update the web.config that is deployed to the app service to turn on logging. To do this, go to Kudo site for your applicaiton by amending the Url slightly to add
scm. just before the
azurewebsites.net domain. For example, if you app service url is
https://myfunkyapp.azurewebsites.net you need to go to
https://myfunkyapp.scm.azurewebsites.net. This will open up Kudo and you can then go to the Debug Console to view and edit the deployed files.
Now, go to
D:\home\site\wwwroot and edit your web.config file to enable logging. Change the
stdoutLogEnabled attribute to
<?xml version="1.0" encoding="utf-8"?> <configuration> <system.webServer> <handlers> <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" /> </handlers> <aspNetCore processPath=".\myfunkyapp.exe" stdoutLogEnabled="true" stdoutLogFile=".\logs\stdout" /> </system.webServer> </configuration>
Make sure you create the
logs folder in
When you hit your app again to generate the error, everything you would normally see in the console when running locally will be output to a file in
D:\home\site\wwwroot\logs. This should give you plenty of information to solve your problem.
But wait! What if you have too many files in the folder and you cannot see your web.config??? By default, only the first 300 files are displayed in the folder view of the debug console. Read on...
This can happen if you have deployed a standalone Asp.Net Core application because you are using version of the runtime not supported in the Azure App Service (like the latest 2.1 version). In this case, all the files for the runtime are deployed making the list of files so long it is truncated.
After doing a little reverse engineering of the page, I discovered that there is a
localStorage setting that is checked called
maxViewItems. If this doesn't exist, it defaults to 300.
So, the solution is simple. Open your browser dev tools and execute the following in the console:
Now the list will display 999 items and you can find the web.config at the bottom of the list and you can edit it.