Fix errors on prod
This commit is contained in:
parent
3ffd8d23a0
commit
9b2b65a152
@ -12,17 +12,21 @@ class Program
|
|||||||
|
|
||||||
app.Run();
|
app.Run();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Calls the startup class and creates the webinterface
|
// Calls the startup class and creates the webinterface
|
||||||
public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
|
public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
|
||||||
WebHost.CreateDefaultBuilder(args)
|
WebHost.CreateDefaultBuilder(args)
|
||||||
.UseUrls("0.0.0.0:5000")
|
.UseUrls("http://0.0.0.0:5000")
|
||||||
.UseStartup<Startup>();
|
.UseStartup<Startup>();
|
||||||
|
|
||||||
public static async void RunMigrations(IWebHost app)
|
public static async void RunMigrations(IWebHost app)
|
||||||
{
|
{
|
||||||
await using var scope = app.Services.CreateAsyncScope();
|
await using var scope = app.Services.CreateAsyncScope();
|
||||||
await using var db = scope.ServiceProvider.GetService<DbContext>();
|
await using var db = scope.ServiceProvider.GetService<DbContext>();
|
||||||
await db.Database.MigrateAsync();
|
|
||||||
|
if (db != null) {
|
||||||
|
await db.Database.MigrateAsync();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user