Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to debug startup Errors on Azure App Service

I am getting this error when my App Service starts on Azure:

An error occurred while starting the application.

I have not been able to find any relevant errors in the event logs.

How can I debug this?

like image 925
Greg Gum Avatar asked Jan 17 '19 10:01

Greg Gum


People also ask

How do I check Azure App Service errors?

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.

How do I debug Azure App Service?

In Solution Explorer, right-click the project, and click Publish. In the Profile drop-down list, select the same profile that you used in Create an ASP.NET app in Azure App Service. Then, click Settings. In the Publish dialog, click the Settings tab, and then change Configuration to Debug, and then click Save.

What is Startup command in Azure App Service?

To specify a startup command or command file: Azure portal: select the app's Configuration page, then select General settings. In the Startup Command field, place either the full text of your startup command or the name of your startup command file. Then select Save to apply the changes.


1 Answers

I found this page very helpful:

In particular, there is a tool in Azure called Kudu Services (Under Development Tools/Advanced Tools) which lets you open a command prompt for your site, and then run dotnet your.dll

This will show you the exact error message that is occurring as if you were running it on your own localhost with all output.

Steps:

  1. Open Kudo
  2. Go to DEBUG CONSOLE (Top Menu), then CMD
  3. This will open a black command window.
  4. CD site
  5. CD wwwroot
  6. DIR to list contents. Find your dll in the list to ensure you are in the right location.
  7. DOTNET your.dll

The site will then start up, or fail to start. If it fails, it will show the relevant messages so you can debug.

like image 95
Greg Gum Avatar answered Dec 30 '22 09:12

Greg Gum