我已经升级到实体框架4.3,并得到以下错误:实体框架抛出NullReferenceException异常在ValidateConsitency
[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中工作。我试图排除模型中的所有内容,并介绍一些事情,直到问题出现 - 但一切正常。
谢谢!
构建发生在哪里?如果它在另一台服务器上,那么是否需要在那里安装缺少的更新? – pantelif
它发生在另一台服务器上。实体框架DLL是从解决方案中引用并保存在解决方案的根目录中 - 因此没有需要更新机器本身。 – SturmUndDrang