2017-04-02 117 views
1

我在使用sqlite到azure時部署.net核心應用程序時遇到困難。我得到我的日誌中的錯誤信息是:.Net核心和Sqlite部署到azure失敗

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 --- 

這使我相信,沒有被正確應用我的遷移。


在我的啓動類我有以下幾點:

services.AddDbContext<ApplicationDbContext>(options => 
    options.UseSqlite(Configuration.GetConnectionString("ConnectionName"))); 

和一個連接字符串:

"ConnectionName": "Filename=./MyApp.sqlite" 

這工作完全在本地,但是當我部署到蔚藍我得到了給定的錯誤。任何想法出了什麼問題,我可以採取哪些措施來解決它?

回答

1

我有一個解決方法。

我還沒有找到一種方法將遷移應用到sqlite作爲我的部署的一部分,我在這方面嘗試過的一切都導致了錯誤。目前我發現在kudu中找到.sqlite文件的位置,然後用我的本地.sqlite文件替換它是個可接受的解決方法。