I have installed Hangfire in my ASP.Core 2.2 project using this guide https://docs.hangfire.io/en/latest/getting-started/aspnet-core-applications.html .
When I delete my
MyProject_devMSSQL db and run
Update-Database only my custom tables are created. After I run the project, the Hangfire tables are added.
appsettings.production.json I have configured the db to be
MyProject_prod and I click on Folder publish with checked Entity Framework Migrations so the build process can create a .sql file in the
EFSQLScripts folder with the SQL I need to apply to the
The problem is that the .sql file contains only my custom tables. When I run the IIS site the Hangfire tables aren't created in
MyProject_prod db, in comparison to when I run the project with F5 locally, where they are created in
MyProject_dev if they do not exists. Looking at the logs I see that the connection to the
MyProject_prod db is made, the error is:
[ERR] Execution BackgroundServerProcess is still in the Failed state for 00:20:45.1406056 due to an exception, will be retried no more than in 00:00:15 System.Data.SqlClient.SqlException (0x80131904): Invalid object name 'HangFire.Server'.
I could export the tables from my
MyProject_dev db and import them in the
MyProject_prod db, but I don't think this would be the right approach. Why aren't the tables created when the app is run under IIS?
User contributions licensed under CC BY-SA 3.0