2013-04-22 1 views
1

엔터티 프레임 워크를 사용하는 방법을 배우고 있습니다.웹 사이트 엔터티 프레임 워크 마이그레이션 ArgumentException

웹 응용 프로그램과 콘솔 프로젝트에서 쉽게 마이그레이션을 수행 할 수 있습니다.

하지만 웹 사이트 프로젝트에서 데이터베이스 모델을 생성하고 마이그레이션을 수행 할 때, 콘솔이 나에게 메시지를 표시

System.ArgumentException: The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG)) 

Server stack trace: 
    at EnvDTE.Properties.Item(Object index) 
    at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Object[]& outArgs) 
    at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg) 

Exception rethrown at [0]: 
    at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg) 
    at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type) 
    at EnvDTE.Properties.Item(Object index) 
    at System.Data.Entity.Migrations.Extensions.ProjectExtensions.GetPropertyValue[T](Project project, String propertyName) 
    at System.Data.Entity.Migrations.MigrationsDomainCommand.GetFacade(String configurationTypeName) 
    at System.Data.Entity.Migrations.EnableMigrationsCommand.FindContextToEnable(String contextTypeName) 
    at System.Data.Entity.Migrations.EnableMigrationsCommand.<>c__DisplayClass2.<.ctor>b__0() 
    at System.Data.Entity.Migrations.MigrationsDomainCommand.Execute(Action command) 
The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG)) 

내가 그것에 대해 무엇을 할 수 있습니까? Q2. 웹 응용 프로그램 프로젝트를 만들면 어떻게 배포 할 수 있습니까? FTP 이외에 웹 사이트를 배포하기위한 다른 방법을 모르겠습니다.

+1

Q1. 마이그레이션은 어떻게 진행하고 있습니까? Q2. 웹 배포 살펴보기 http://msdn.microsoft.com/en-us/library/dd465337.aspx – Thewads

+0

나는 단지 enable-migrations를 입력했습니다. 그게 다야. 다른 매개 변수에 대해 무엇을 넣어야할지 모르겠습니다. –

+0

이 정확한 문제가 있습니다. Entity Framework는 웹 응용 프로그램 및 콘솔 응용 프로그램의 'Enable-Migrations'를 사용하여 올바르게 작동합니다. 그러나 웹 사이트 프로젝트 내에서 사용하려고 할 때 오류 메시지가 나타나고 찾은 것 외에는 아무 것도 도움이되지 않습니다. (주로 프로젝트 이름을 명령에 전달한다고 말하면서도 작동하지 않습니다) – Ant

답변

0

문제의 원인을 잘 모르고 있지만 모델 및 컨텍스트가 포함 된 별도의 어셈블리를 만든 다음 해당 프로젝트에서 마이그레이션을 활성화하여 문제를 해결할 수 있습니다. 해당 프로젝트를 웹 사이트 프로젝트에서 참조하십시오.