【问题标题】:EntityFramework 6.1.3 enable-migrations "The domain manager specified by the host could not be instantiated"EntityFramework 6.1.3 enable-migrations“无法实例化主机指定的域管理器”
【发布时间】:2016-05-10 16:15:14
【问题描述】:

我使用托管在 Azure 中的 SQL 数据库在 Azure 上托管了一个全新的应用程序。我的身份验证(使用 ASP.NET 身份)以及我的第一个包含一些数据的表(我首先设计数据库)都可以正常工作。我使用 EF 从数据库优先生成上下文,它创建了我的模型类和我的上下文。现在我已准备好添加第二个表,但我想这次我会尝试先编写代码。

我进入包管理器控制台并输入Enable-Migrations

我收到此错误:

Exception calling "CreateDomain" with "3" argument(s): "The domain manager specified by the host could not be instantiated."
At C:\Users\Alex\projects\SpellbookAPI\packages\EntityFramework.6.1.3\tools\EntityFramework.psm1:717 char:5
+     $domain = [AppDomain]::CreateDomain('Migrations', $null, $info)
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : TypeLoadException

还有一大堆:

You cannot call a method on a null-valued expression.
At C:\Users\Alex\projects\SpellbookAPI\packages\EntityFramework.6.1.3\tools\EntityFramework.psm1:718 char:5
+     $domain.SetData('project', $project)
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull

知道是什么原因导致这些/如何解决吗?

编辑:我不知道是否需要提及,该应用程序是具有身份验证的 .NET 4.6.1 Web API

【问题讨论】:

    标签: c# asp.net entity-framework azure


    【解决方案1】:

    这最终成为 Visual Studio 15 Preview 的一个问题。一旦我尝试使用 VS2015 启用迁移,它工作得很好。

    【讨论】:

      猜你喜欢
      • 2014-12-01
      • 1970-01-01
      • 2012-05-11
      • 2013-02-09
      • 2019-03-10
      • 1970-01-01
      • 1970-01-01
      • 2020-01-25
      • 2017-10-18
      相关资源
      最近更新 更多