Troubleshooting startup Failures on Azure App Service.
3 min read
Troubleshooting ASP.NET CORE startup failures can be a real nightmare for developers. Before proceeding further, you would be interested to know that they are different startup errors, each with its own HTTP server code. Below is a list of startup error you may encounter. List of known startup errors and meaning.
So, after deployment, when you try to access your application URL on the web browser you might get to experience any of the listed failures. The first step will be to quickly raise a support ticket thinking this is a platform issue (considering that you deployed on Azure PaaS).
How do we figure out why my application does not start?
You can do this by merely enabling stdout logging. You probably noticed stdoutLogFile and stdoutLogEnabled attributes on the aspNetCore element. They are very helpful to diagnose issues – especially issues related to application startup.
The ASP.NET Core Module stdout log often records useful error messages not found in the Application Event Log. To enable and view stdout logs:
- In the Azure Portal, navigate to the web app.
- In the App Service blade, enter kudu in the search box.
- Select Advanced Tools > Go.
- Select Debug console > CMD.
- Navigate to site/wwwroot
- Select the pencil icon to edit the web.config file.
- You have to change the stdoutLogEnabled from ‘false’, to ‘true’
- And the stdoutLogFile from “.\logs\stdout” to "\?\%home%\LogFiles"
Note: By design when you have the WEBSITE_RUN_FROM_PACKAGE app setting enabled the files are read-only by design. So, when you access kudu to edit the wwwroot folder, the 409 conflict error is encountered.
Warning: Failure to disable the stdout log can lead to app or server failure. There is no limit on log file size, or the number of log files created. Only use stdout logging to troubleshoot app startup problems.
After all the activities carried out above, you will get a result similar to the screenshot below
I hope this helps to fix future issues relating to startup failures.