2012-09-24 5 views
0

먼저 DB를 만들 때 EF 코드를 사용했습니다. dev에 잘 작동합니다. Windows 서버 2003 상자에 복사하면 아래에 나열된 오류가 발생합니다.원격 서버에 배포 할 때 Entity Framework 스키마 오류가 발생했습니다.

EF 5, .NET 4.0.

.net 4 프레임 워크를 제거하고 다시 설치했습니다. 다른 컴퓨터에서도 테스트가 가능합니다.

내 Windows Server 2008 상자에서 제대로 작동합니다. 다른 2003 상자에서는 그렇지 않습니다.

방정식에서 MVC를 제거하기 위해 DB의 일부 데이터를 나열하는 간단한 콘솔 앱을 만들었습니다. - 거기에 같은 오류가 있습니다.

컴퓨터에 .net 4.5가 설치된 VS 2012의 모든 것을 작성했습니다. 그게 문제가 발생할 수 있습니다, 그래서 나는 VS 2010 대상 .net 4의 모든 것을 다시 작성하고 EF 5/.net4 dll에 대한 참조를 수동으로 추가했습니다. 같은 일이, 제 2 dev에 시스템에서 잘 작동하고, 2008 서버 만에 없습니다 2003

오류 : 여기

Schema specified is not valid. Errors: 
(0,0) : warning 0005: Could not find schema information for the attribute 'Namespace'. 
(0,0) : warning 0005: Could not find schema information for the attribute 'Provider'. 
(0,0) : warning 0005: Could not find schema information for the attribute 'ProviderManifestToken'. 
(0,0) : warning 0005: Could not find schema information for the attribute 'Alias'. 
(0,0) : error 0010: The element Schema in namespace http://schemas.microsoft.com/ado/2009/11/edm/ssdl was unexpected for the root element. The expected Schema in one of the following namespaces: http://schemas.microsoft.com/ado/2006/04/edm/ssdl, http://schemas.microsoft.com/ado/2009/02/edm/ssdl. 

이 스택 트레이스 (그것은 MVC 응용 프로그램의)

 
[MetadataException: Schema specified is not valid. Errors: 
(0,0) : warning 0005: Could not find schema information for the attribute 'Namespace'. 
(0,0) : warning 0005: Could not find schema information for the attribute 'Provider'. 
(0,0) : warning 0005: Could not find schema information for the attribute 'ProviderManifestToken'. 
(0,0) : warning 0005: Could not find schema information for the attribute 'Alias'. 
(0,0) : error 0010: The element Schema in namespace http://schemas.microsoft.com/ado/2009/11/edm/ssdl was unexpected for the root element. The expected Schema in one of the following namespaces: http://schemas.microsoft.com/ado/2006/04/edm/ssdl, http://schemas.microsoft.com/ado/2009/02/edm/ssdl.] 
    System.Data.Metadata.Edm.Loader.ThrowOnNonWarningErrors() +8508793 
    System.Data.Metadata.Edm.Loader.LoadItems(IEnumerable`1 xmlReaders, IEnumerable`1 sourceFilePaths) +181 
    System.Data.Metadata.Edm.StoreItemCollection.Init(IEnumerable`1 xmlReaders, IEnumerable`1 filePaths, Boolean throwOnError, DbProviderManifest& providerManifest, DbProviderFactory& providerFactory, String& providerManifestToken, Memoizer`2& cachedCTypeFunction) +211 
    System.Data.Metadata.Edm.StoreItemCollection..ctor(IEnumerable`1 xmlReaders) +295 
    System.Data.Entity.Migrations.Extensions.XDocumentExtensions.GetStoreItemCollection(XDocument model, DbProviderInfo& providerInfo) +180 
    System.Data.Entity.Migrations.Infrastructure.EdmModelDiffer.Diff(XDocument sourceModel, XDocument targetModel, String connectionString) +48 
    System.Data.Entity.Internal.InternalContext.ModelMatches(XDocument model) +45 
    System.Data.Entity.Internal.ModelCompatibilityChecker.CompatibleWithModel(InternalContext internalContext, ModelHashCalculator modelHashCalculator, Boolean throwIfNoMetadata) +65 
    System.Data.Entity.Internal.InternalContext.CompatibleWithModel(Boolean throwIfNoMetadata) +52 
    System.Data.Entity.CreateDatabaseIfNotExists`1.InitializeDatabase(TContext context) +239 
    System.Data.Entity.Internal.c__DisplayClass8.b__6() +19 
    System.Data.Entity.Internal.InternalContext.PerformInitializationAction(Action action) +72 

[DataException: An exception occurred while initializing the database. See the InnerException for details.] 
    System.Data.Entity.Internal.InternalContext.PerformInitializationAction(Action action) +117 
    System.Data.Entity.Internal.InternalContext.PerformDatabaseInitialization() +186 
    System.Data.Entity.Internal.LazyInternalContext.b__4(InternalContext c) +7 
    System.Data.Entity.Internal.RetryAction`1.PerformAction(TInput input) +118 
    System.Data.Entity.Internal.LazyInternalContext.InitializeDatabaseAction(Action`1 action) +190 
    System.Data.Entity.Internal.LazyInternalContext.InitializeDatabase() +73 
    System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type entityType) +28 
    System.Data.Entity.Internal.Linq.InternalSet`1.Initialize() +56 
    System.Data.Entity.Internal.Linq.InternalSet`1.GetEnumerator() +15 
    System.Data.Entity.Infrastructure.DbQuery`1.System.Collections.Generic.IEnumerable.GetEnumerator() +40 
    System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) +315 
    System.Linq.Enumerable.ToList(IEnumerable`1 source) +58 
    Kiosk.Controllers.KioskEventController.Index() in c:\Dev\hbkiosk\Kiosk\Controllers\KioskEventController.cs:23 
    lambda_method(Closure , ControllerBase , Object[]) +62 
    System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters) +17 
    System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) +188 
    System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +27 
    System.Web.Mvc.Async.c__DisplayClass42.b__41() +28 
    System.Web.Mvc.Async.c__DisplayClass8`1.b__7(IAsyncResult _) +12 
    System.Web.Mvc.Async.WrappedAsyncResult`1.End() +50 
    System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult) +29 
    System.Web.Mvc.Async.c__DisplayClass39.b__33() +59 
    System.Web.Mvc.Async.c__DisplayClass4f.b__49() +240 
    System.Web.Mvc.Async.c__DisplayClass37.b__36(IAsyncResult asyncResult) +12 
    System.Web.Mvc.Async.WrappedAsyncResult`1.End() +50 
    System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethodWithFilters(IAsyncResult asyncResult) +31 
    System.Web.Mvc.Async.c__DisplayClass2a.b__20() +23 
    System.Web.Mvc.Async.c__DisplayClass25.b__22(IAsyncResult asyncResult) +128 
    System.Web.Mvc.Async.WrappedAsyncResult`1.End() +50 
    System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) +26 
    System.Web.Mvc.c__DisplayClass1d.b__18(IAsyncResult asyncResult) +14 
    System.Web.Mvc.Async.c__DisplayClass4.b__3(IAsyncResult ar) +25 
    System.Web.Mvc.Async.WrappedAsyncResult`1.End() +55 
    System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +41 
    System.Web.Mvc.Async.c__DisplayClass4.b__3(IAsyncResult ar) +25 
    System.Web.Mvc.Async.WrappedAsyncResult`1.End() +55 
    System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +28 
    System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.EndExecute(IAsyncResult asyncResult) +10 
    System.Web.Mvc.c__DisplayClass8.b__3(IAsyncResult asyncResult) +28 
    System.Web.Mvc.Async.c__DisplayClass4.b__3(IAsyncResult ar) +25 
    System.Web.Mvc.Async.WrappedAsyncResult`1.End() +55 
    System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +30 
    System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +9 
    System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +8836913 
    System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +184 

입니다
+0

참조하는 entityframework.dll의 파일 버전을 확인할 수 있습니까? NuGet 패키지에는 두 가지 버전이 있습니다. 4.4 for .NET 4 및 5.0 for .NET 4.5 –

+0

4.4입니다. VS 2012는 대상 프레임 워크를 변경하고 nuget 패키지를 uninst/reinst 한 후에도 5를 사용하기를 원했기 때문에 참조를 제거하고 수동으로 4.4 dll에 대한 참조를 추가했습니다. 출력 디렉토리에 4.4 dll이 포함되어 있고 프로젝트가 계속 제대로 실행되는지 확인했습니다. – Zeph

+0

컨텍스트 클래스에이 특성을 넣으십시오. [DbModelBuilderVersion (DbModelBuilderVersion.V4_1)] –

답변

3

프로젝트에 설치된 적절한 dll로 db를 새로 만들려면 연결 문자열을 변경하여이 문제를 해결할 수있었습니다. 그런 다음 이전 db의 데이터를 새 db로 마이그레이션했습니다.

내 가정은 EF 5 코드가 DB에 일부 메타 데이터를 저장했다는 것입니다 (확인할 수는 없지만). EF 코드는 데이터베이스가 존재하지 않는 경우 먼저 db/schema를 생성하므로 연결 문자열을 존재하지 않는 데이터베이스로 변경하고 프로젝트를 실행 한 다음 EF에서 db를 작성한 다음 생성 된 DB에서 기존 데이터를 마이그레이션하게합니다 v.5에 의해 v.4에 의해 생성 된 db에.

+0

"db를 신선한 상태로 만들기 위해 연결 문자열을 변경하는 것"에 대해 더 자세히 설명해 주시겠습니까? 나는 똑같은 문제를 겪고 있는데,이 대답은 해상도가있는 유일한 장소입니다. –

+1

확실한 답변 - 내 대답 업데이트 – Zeph

0

.NET Framework를 4.5로 업데이트하여 작동했습니다.

관련 문제