【发布时间】:2019-03-29 03:47:01
【问题描述】:
我正在尝试通过关注this tutorial 将我的 Web 应用程序从成员身份迁移到 ASP.Net Identity。但是当我执行 Enable-migrations 命令时出现此错误:
块引用 PM> 启用迁移 System.ArgumentException:参数不正确。 (HRESULT 异常:0x80070057 (E_INVALIDARG))
服务器堆栈跟踪: à EnvDTE.Properties.Item(对象索引) à System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Object[]& outArgs) à System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg)
在 [0] 处重新抛出异常: à System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg) à System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 类型) à EnvDTE.Properties.Item(对象索引) à System.Data.Entity.Migrations.Extensions.ProjectExtensions.GetPropertyValue[T](Project project, String propertyName) à System.Data.Entity.Migrations.MigrationsDomainCommand.GetFacade(String configurationTypeName, Boolean useContextWorkingDirectory) à System.Data.Entity.Migrations.EnableMigrationsCommand.FindContextToEnable(String contextTypeName) à System.Data.Entity.Migrations.EnableMigrationsCommand.c__DisplayClass2.<.ctor>b__0() à System.Data.Entity.Migrations.MigrationsDomainCommand.Execute(动作命令) 参数不正确。 (HRESULT 异常:0x80070057 (E_INVALIDARG))
我尝试使用参数 -ProjectName 和 -StartUpProjectName 但它不起作用。我使用 EntityFramework 6.2.0。需要帮助。
【问题讨论】:
-
您的解决方案结构是什么样的?您的模型类是否与 Web 应用程序分开到不同的项目中?
-
@user1011627,我所有的课程都在同一个项目中
-
你能显示你正在尝试运行的实际命令吗?
-
另外,您在 web.config 中是否有项目的“全球化”部分?
-
enable-migrations -ProjectName myApp和enable-migrations -StartUpProjectName myApp。 myApp 是项目的名称。
标签: asp.net entity-framework entity-framework-migrations