Troubleshooting Azure WEBSITE_RUN_FROM_PACKAGE deployment

You may already know about the new Azure Run From Package feature. This is an excellent new feature comparable with Containers. The zip file does not need to be changed when you move from Test environment to Production. Just point your Application Settings to the zip file on your Azure storage.

The problem with this type of deployment is when you are trying to troubleshoot your application code. The web.config now is read-only and cannot be modified without repacking the new ZIP.

The Azure “Log stream” will not help. To output errors into Azure “Log stream” add the following loggers to your code:

public void ConfigureServices(IServiceCollection services)
        {
            services.AddLogging(loggingBuilder =>
            {
                loggingBuilder.AddConfiguration(this.Configuration.GetSection("Logging"));
                loggingBuilder.AddConsole();
                loggingBuilder.AddDebug();
                loggingBuilder.AddAzureWebAppDiagnostics();
            });
...
}

The AddAzureWebAppDiagnostics will output error messages into the Azure “Log stream“. Make sure you enable the “Application Logging” and “Detailed error messages” in the Azure Diagnostics logs.


PM> Install-Package Microsoft.Extensions.Logging.AzureAppServices -Version 2.2.0