Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SQLite Entity Framework Azure App sqlite3_blob_open does not have an implementation

TLDR; I'm getting an error when reading from SQLite database deployed to Azure webb app. Works fine locally..

TypeLoadException: Method 'sqlite3_blob_open' in type 'SQLitePCL.SQLite3Provider_e_sqlite3' from assembly 'SQLitePCLRaw.provider.e_sqlite3, Version=1.0.0.0, Culture=neutral, PublicKeyToken=9c301db686d0bd12' does not have an implementation.

I use the following technologies

  • SQLite for EntityFrameworkCore
  • Asp.Net Core
  • Azure web app, free service plan
  • Project created from React.js template in Visual Studio 2017

enter image description here

It works locally but when I deploy it to the Azure web app I get the following error when trying to read data from the database.

enter image description here

In my startup.cs I have the following

public void ConfigureServices(IServiceCollection services)
{
    services.AddMvc();
    services.AddDbContext<AppDbContext>(options => options.UseSqlite(@"Data Source=appDatabase.db"));
}

AppDbContext.cs

public class AppDbContext : DbContext
{
    public AppDbContext(DbContextOptions<AppDbContext> options)
        : base(options)
    { }

    public DbSet<Persons> Persons { get; set; }
}

My SQLite database file "appDatabase.db" is placed directly in the web projects folder next to the startup.cs

enter image description here

like image 280
Erik Avatar asked Sep 09 '26 14:09

Erik


1 Answers

The issue was fixed after adding another nuget package called SQLitePCLRaw.bundle_e_sqlite3

https://github.com/ericsink/SQLitePCL.raw

https://github.com/ericsink/SQLitePCL.raw

I found this thread https://github.com/praeclarum/sqlite-net/issues/567 that mentioned some sort of bundle package so I searched nuget and found this.

like image 132
Erik Avatar answered Sep 13 '26 01:09

Erik



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!