HTTP Error 500.30 - ASP.NET Core app failed to start


After deploying a .NET Core app to an Azure AppService your site returns the following error:

HTTP Error 500.30 - ASP.NET Core app failed to start


This error can come up for any numbers of reasons but generally it's because an unhandled exception has occurred in Startup.cs or in Program.cs (in .NET 6 Program.cs is where most of the startup logic runs by default).

In order to troubleshoot this you'll need to step through each piece of the startup to determine what is causing the exception. In my case, I had added a config for development with an optional flag set to false which stopped the pipeline when it didn't exist in production.


builder.Host.ConfigureAppConfiguration((ctx, config) =>
                       optional: false,
                       reloadOnChange: true)
          .AddJsonFile($"appsettings.{ctx.HostingEnvironment.EnvironmentName}.json", optional: true);

If you don't have the logs available if you need a better message on Azure, you can go into the Azure portal and add an environment variable for ASPNETCORE_ENVIRONMENT and set the value to Development. Azure will then show you the detailed error information including the stack trace. Remember, don't forget to remove that environment variable when you're done or reset it to Production.

Leave a comment

Please note that we won't show your email to others, or use it for sending unwanted emails. We will only use it to render your Gravatar image and to validate you as a real person.