Reputation: 1054
I'm having difficulty deploying a .net core app using sqlite to azure. The error message I'm getting in my logs is:
fail: Microsoft.EntityFrameworkCore.Query.RelationalQueryCompilationContextFactory[1]
An exception occurred in the database while iterating the results of a query.
Microsoft.Data.Sqlite.SqliteException: SQLite Error 1: 'no such table: AspNetUserLogins'.
at Microsoft.Data.Sqlite.Interop.MarshalEx.ThrowExceptionForRC(Int32 rc, Sqlite3Handle db)
at Microsoft.Data.Sqlite.SqliteCommand.ExecuteReader(CommandBehavior behavior)
at Microsoft.Data.Sqlite.SqliteCommand.ExecuteReaderAsync(CommandBehavior behavior, CancellationToken cancellationToken)
at Microsoft.Data.Sqlite.SqliteCommand.<ExecuteDbDataReaderAsync>d__53.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
This leads me to believe that my migrations aren't being applied correctly.
In my startup class I have the following:
services.AddDbContext<ApplicationDbContext>(options =>
options.UseSqlite(Configuration.GetConnectionString("ConnectionName")));
and a connection string of :
"ConnectionName": "Filename=./MyApp.sqlite"
This works perfectly locally, but when I deploy to azure I get the given error. Any ideas what's gone wrong and what steps I can take to fix it?
Upvotes: 1
Views: 210
Reputation: 1054
I've got a workaround.
I haven't worked out a way to apply migrations to sqlite as part of my deployment, everything I've tried on that front has caused errors. For the time being I found that finding the location of the .sqlite file in kudu, and then replacing it with my local .sqlite file is an acceptable workaround.
Upvotes: 1