我已升级到 Entity Framework 4.3 并收到以下错误:
[NullReferenceException: Object reference not set to an instance of an object.]
System.Data.Entity.ModelConfiguration.Configuration.Properties.Navigation.NavigationPropertyConfiguration.ValidateConsistency(NavigationPropertyConfiguration navigationPropertyConfiguration) +588
System.Data.Entity.ModelConfiguration.Configuration.Properties.Navigation.NavigationPropertyConfiguration.Configure(EdmNavigationProperty navigationProperty, EdmModel model, EntityTypeConfiguration entityTypeConfiguration) +122
System.Data.Entity.ModelConfiguration.Configuration.Types.EntityTypeConfiguration.ConfigureAssociations(EdmEntityType entityType, EdmModel model) +160
System.Data.Entity.ModelConfiguration.Configuration.Types.EntityTypeConfiguration.Configure(EdmEntityType entityType, EdmModel model) +102
System.Data.Entity.ModelConfiguration.Configuration.ModelConfiguration.ConfigureEntities(EdmModel model) +95
System.Data.Entity.DbModelBuilder.Build(DbProviderManifest providerManifest, DbProviderInfo providerInfo) +112
System.Data.Entity.DbModelBuilder.Build(DbConnection providerConnection) +58
System.Data.Entity.Internal.LazyInternalContext.CreateModel(LazyInternalContext internalContext) +62
System.Data.Entity.Internal.RetryLazy`2.GetValue(TInput input) +117
System.Data.Entity.Internal.LazyInternalContext.InitializeContext() +452
System.Data.Entity.Internal.InternalContext.ForceOSpaceLoadingForKnownEntityTypes() +55
System.Data.Entity.DbContext.System.Data.Entity.Infrastructure.IObjectContextAdapter.get_ObjectContext() +25
Namespace.Test.Start() in c:\Builds\6\Test\DevDeployed\Sources\Namespace.Test.Kernel\Loader.cs:97
MvcApplication.Application_Start() in c:\Builds\6\Test\DevDeployed\Sources\Namespace.Test.Kernel\Web\Global.asax.cs:48
如果我在 Visual Studio 中构建应用程序可以工作,但是自动部署网站(通过 TFS)会给出这个错误(就像在命令行中使用 MSBUILD 一样)。
似乎没有任何方法可以得到一个像样的错误消息,所以我对导致问题的原因一无所知。我不认为这是一个映射问题,因为我可以让它在 VS 中工作。我尝试从模型中排除所有内容并引入内容,直到出现问题 - 但一切正常。
谢谢!