Markus
Markus

Reputation: 22456

ASP.NET Core on Azure Web Apps, adding Azure Web App Diagnostics throws FileNotFoundException on startup

We deploy a ASP.NET Core 3.0 web application to Azure Web Apps. In order to get log messages we want to use Azure Web Apps diagnostics. We add the logging provider in program.cs:

public static IHostBuilder CreateHostBuilder(string[] args) =>
    Host.CreateDefaultBuilder(args)
        .ConfigureLogging(logging => logging.AddAzureWebAppDiagnostics())
        .ConfigureWebHostDefaults(webBuilder =>
        {
            webBuilder.UseStartup<Startup>();
        });

However, on application startup, a FileNotFoundException is logged to stdout (for details and a stack trace see below) and the application fails to start (Status code 500.30).

We have taken the following steps to find the reason, but up to now, we were not successful:

Does anyone know a reason for this behavior or some other steps that we can use to get more details?


Exception details

Unhandled exception. System.IO.FileNotFoundException: Error reading the D:\home\site\diagnostics\ directory.

at System.IO.FileSystemWatcher.StartRaisingEvents()

at System.IO.FileSystemWatcher.StartRaisingEventsIfNotDisposed()

at System.IO.FileSystemWatcher.set_EnableRaisingEvents(Boolean value)

at Microsoft.Extensions.FileProviders.Physical.PhysicalFilesWatcher.TryEnableFileSystemWatcher()

at Microsoft.Extensions.FileProviders.Physical.PhysicalFilesWatcher.CreateFileChangeToken(String filter)

at Microsoft.Extensions.FileProviders.PhysicalFileProvider.Watch(String filter)

at Microsoft.Extensions.Configuration.FileConfigurationProvider.<.ctor>b__1_0()

at Microsoft.Extensions.Primitives.ChangeToken.ChangeTokenRegistration1..ctor(Func1 changeTokenProducer, Action`1 changeTokenConsumer, TState state)

at Microsoft.Extensions.Primitives.ChangeToken.OnChange(Func`1 changeTokenProducer, Action changeTokenConsumer)

at Microsoft.Extensions.Configuration.FileConfigurationProvider..ctor(FileConfigurationSource source)

at Microsoft.Extensions.Configuration.Json.JsonConfigurationSource.Build(IConfigurationBuilder builder)

at Microsoft.Extensions.Configuration.ConfigurationBuilder.Build()

at Microsoft.Extensions.Logging.AzureAppServices.SiteConfigurationProvider.GetAzureLoggingConfiguration(IWebAppContext context)

at Microsoft.Extensions.Logging.AzureAppServicesLoggerFactoryExtensions.AddAzureWebAppDiagnostics(ILoggingBuilder builder, IWebAppContext context)

at Microsoft.Extensions.Logging.AzureAppServicesLoggerFactoryExtensions.AddAzureWebAppDiagnostics(ILoggingBuilder builder)

at sevacation.Program.<>c.b__1_0(ILoggingBuilder logging) in D:\a\1\s\sevacation\Program.cs:line 22

at Microsoft.Extensions.Hosting.HostingHostBuilderExtensions.<>c__DisplayClass5_0.b__1(ILoggingBuilder builder)

at Microsoft.Extensions.DependencyInjection.LoggingServiceCollectionExtensions.AddLogging(IServiceCollection services, Action`1 configure)

at Microsoft.Extensions.Hosting.HostingHostBuilderExtensions.<>c__DisplayClass5_0.b__0(HostBuilderContext context, IServiceCollection collection)

at Microsoft.Extensions.Hosting.HostBuilder.CreateServiceProvider()

at Microsoft.Extensions.Hosting.HostBuilder.Build()

at sevacation.Program.Main(String[] args) in D:\a\1\s\sevacation\Program.cs:line 17

Upvotes: 1

Views: 666

Answers (1)

Falco Alexander
Falco Alexander

Reputation: 3332

There seems to be a current issue with .zip deployment (as of Dec. 2019)

Try to use a different deployment method, like WebDeploy, Git, etc.

Upvotes: 1

Related Questions