AspNetCore.Diagnostics.HealthChecks: The process cannot access the file healthchecksdb

Hi.

After deploying web application with integrated health-check UI to Azure we’ve faced with error: Error can be fixed by restarting the app itself. Error occurs periodically after deploying new version of the application.

An error occurred while starting the application.
AggregateException: One or more errors occurred. (The process cannot access the file 'D:\home\site\wwwroot\healthchecksdb' because it is being used by another process.)
System.Threading.Tasks.Task.Wait(int millisecondsTimeout, CancellationToken cancellationToken)

IOException: The process cannot access the file 'D:\home\site\wwwroot\healthchecksdb' because it is being used by another process.
System.IO.FileSystem.DeleteFile(string fullPath)

AggregateException: One or more errors occurred. (The process cannot access the file 'D:\home\site\wwwroot\healthchecksdb' because it is being used by another process.)
System.Threading.Tasks.Task.Wait(int millisecondsTimeout, CancellationToken cancellationToken)
Microsoft.Extensions.DependencyInjection.ServiceCollectionExtensions.AddHealthChecksUI(IServiceCollection services, string databaseName)
Finturi.Api.Extensions.HealthCheckExtensions.AppendHealthChecks(IServiceCollection services) in HealthCheckExtensions.cs
Finturi.Api.Startup.ConfigureServices(IServiceCollection services) in Startup.cs
Microsoft.AspNetCore.Hosting.ConventionBasedStartup.ConfigureServices(IServiceCollection services)
Microsoft.AspNetCore.Hosting.Internal.WebHost.EnsureApplicationServices()
Microsoft.AspNetCore.Hosting.Internal.WebHost.Initialize()
Microsoft.AspNetCore.Hosting.Internal.WebHost.BuildApplication()

Show raw exception details
IOException: The process cannot access the file 'D:\home\site\wwwroot\healthchecksdb' because it is being used by another process.
System.IO.FileSystem.DeleteFile(string fullPath)
System.IO.File.Delete(string path)
Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal.SqliteDatabaseCreator.Delete()
Microsoft.EntityFrameworkCore.Storage.RelationalDatabaseCreator.DeleteAsync(CancellationToken cancellationToken)
Microsoft.EntityFrameworkCore.Storage.RelationalDatabaseCreator.EnsureDeletedAsync(CancellationToken cancellationToken)
Microsoft.Extensions.DependencyInjection.ServiceCollectionExtensions.CreateDatabase(IServiceProvider serviceProvider)


.NET Core 4.6.27521.02 X86 v4.0.0.0    |   Microsoft.AspNetCore.Hosting version 2.2.0-rtm-35687    |    Microsoft Windows 10.0.14393  

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 2
  • Comments: 20 (6 by maintainers)

Most upvoted comments

Hi @yagoluiz

I try to create a repro ASAP, but probably I need some days. Is curious that the error only occurs with custom healchecks.

Storage providers feature has been implemented in UI version 3.1.1-preview1. https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/issues/455#issuecomment-613093369 Maybe it’s interesting trying with InMemory or another database provider