I'm trying to use Healthchecks UI in my asp.net core application with SqlServer.Storage
for history purposes. It works with InMemoryStorage
(without history part, of course).
So, Startup.cs
code is like this:
services.AddHealthChecks()
.AddHangfire(...)
.AddDbContextCheck<...>("Database")
.AddAzureBlobStorage(...)
.AddProcessAllocatedMemoryHealthCheck(...)
.AddCheck(...);
services
.AddHealthChecksUI(settings =>
{
settings.SetEvaluationTimeInSeconds(...);
settings.SetMinimumSecondsBetweenFailureNotifications(...);
settings.MaximumHistoryEntriesPerEndpoint(...);
})
.AddSqlServerStorage(Configuration.GetConnectionString("..."));
later, additional configuration is in Configure
method
Everything works when AddInMemoryStorage
is used instead of AddSqlServerStorage
. When AddSqlServerStorage
is used, app crashes on startup, with
SqlException: Invalid object name 'Configurations'.
Sure, SQL tables are missing, but I cannot force [migration from nuget package to be applied to database.
Of course, I could copy/paste migration or create tables in database but I would like to skip that because of future changes and keeping code clean.
Can someone point me in right direction to solve this? Thanks