Closed russosalv closed 5 years ago
For what it's worth, I was able to work around this error message today by installing package SQLitePCLRaw.bundle_e_sqlite3
and configuring hangfire along the lines of the below:
//startup.cs - in ConfigureServices(IServiceCollection services)
services.AddHangfire((configuration) =>
{
//hangfire configuration
SQLitePCL.Batteries.Init();
string connectionString = Configuration.GetConnectionString("hangfire");
SQLiteStorage hangfireTaskStorage = new SQLiteStorage(connectionString, new SQLiteStorageOptions());
configuration.UseStorage(hangfireTaskStorage);
configuration.UseActivator(new HangfireActivator(services.BuildServiceProvider()));
RecurringJob.AddOrUpdate<Task2>(t => t.Run(), "*/10 * * * *");
});
// startup.cs - in Configure(IApplicationBuilder app, IHostingEnvironment env, IApplicationLifetime applicationLifetime)
BackgroundJobServerOptions option = new BackgroundJobServerOptions { WorkerCount = 1};
app.UseHangfireServer(option);
Using dotnet core 2.1.4.
Not sure if it's correct, but it seems to work.
Also don't forget to ensure that your SQLite connection string is correct. I found it to be entirely different to the PostgreSQL/MySQL/SQLServer connection strings that I'm used to.
just need to add Microsoft.Data.Sqlite package reference
running on .net core 2.0 webApi project
You need to call SQLitePCL.raw.SetProvider(). If you are using a bundle package, this is done by calling SQLitePCL.Batteries.Init().
connection string = Data Source=:memory:;
at startup db do not exist