【问题标题】:.Net core and Sqlite deployment to azure failing.Net 核心和 Sqlite 部署到 azure 失败
【发布时间】:2017-04-03 05:21:55
【问题描述】:

我在使用 sqlite 到 azure 部署 .net 核心应用程序时遇到了困难。我在日志中收到的错误消息是:

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"

这在本地工作得很好,但是当我部署到天蓝色时,我得到了给定的错误。任何想法出了什么问题以及我可以采取哪些步骤来解决它?

【问题讨论】:

    标签: sqlite azure .net-core


    【解决方案1】:

    我有一个解决方法。

    我还没有想出一种方法来将迁移应用到 sqlite 作为我的部署的一部分,我在这方面尝试的一切都导致了错误。目前我发现在 kudu 中找到 .sqlite 文件的位置,然后用我的本地 .sqlite 文件替换它是一种可以接受的解决方法。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-02-04
      • 2019-06-27
      • 2020-06-21
      • 1970-01-01
      • 1970-01-01
      • 2020-01-06
      相关资源
      最近更新 更多