C# '的类型初始值设定项;System.Data.Entity.Internal.AppConfig';在WCF RIA服务中引发异常
我最近将Wcf应用程序中的EntityFramework从v5更新到了v6。发布该服务后,该服务可以正常工作几个小时。后来所有服务都抛出了一个异常,如下所示,我尝试了所有建议的解决方案,请任何人帮我C# '的类型初始值设定项;System.Data.Entity.Internal.AppConfig';在WCF RIA服务中引发异常,c#,wcf-ria-services,entity-framework-6,C#,Wcf Ria Services,Entity Framework 6,我最近将Wcf应用程序中的EntityFramework从v5更新到了v6。发布该服务后,该服务可以正常工作几个小时。后来所有服务都抛出了一个异常,如下所示,我尝试了所有建议的解决方案,请任何人帮我 <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Body><s:Fault><faultcode xmlns:a="http://schemas.microsoft.com
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Body><s:Fault><faultcode xmlns:a="http://schemas.microsoft.com/net/2005/12/windowscommunicationfoundation/dispatcher">
a:InternalServiceFault</faultcode><faultstring xml:lang="en-US">The type initializer for 'System.Data.Entity.Internal.AppConfig' threw an exception.</faultstring><detail>
<ExceptionDetail xmlns="http://schemas.datacontract.org/2004/07/System.ServiceModel" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"><HelpLink i:nil="true"/><InnerException>
<HelpLink i:nil="true"/><InnerException><HelpLink i:nil="true"/><InnerException i:nil="true"/><Message>Could not load file or assembly 'EntityFramework, Version=6.0.0.0, Culture=neutral,
PublicKeyToken=b77a5d561934e089' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)</Message>
<StackTrace> at System.Configuration.TypeUtil.GetTypeWithReflectionPermission(IInternalConfigHost host, String typeString, Boolean throwOnError)
at System.Configuration.RuntimeConfigurationRecord.RuntimeConfigurationFactory.Init(RuntimeConfigurationRecord configRecord, FactoryRecord factoryRecord)
at System.Configuration.RuntimeConfigurationRecord.RuntimeConfigurationFactory.InitWithRestrictedPermissions(RuntimeConfigurationRecord configRecord, FactoryRecord factoryRecord)
at System.Configuration.RuntimeConfigurationRecord.CreateSectionFactory(FactoryRecord factoryRecord)
at System.Configuration.BaseConfigurationRecord.FindAndEnsureFactoryRecord(String configKey, Boolean& isRootDeclaredHere)</StackTrace><Type>System.IO.FileLoadException</Type></InnerException>
<Message>An error occurred creating the configuration section handler for entityFramework: Could not load file or assembly 'EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5d561934e089' or one of its dependencies.
The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) (C:\inetpub\wwwroot\apps.sysinformation.net\HelpDesk\web.config line 5)</Message><StackTrace> at System.Configuration.
BaseConfigurationRecord.FindAndEnsureFactoryRecord(String configKey, Boolean& isRootDeclaredHere)
at System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean requestIsHere, Object& result, Object& resultRuntimeObject)
at System.Configuration.BaseConfigurationRecord.GetSection(String configKey)
at System.Data.Entity.Internal.AppConfig..ctor()
at System.Data.Entity.Internal.AppConfig..cctor()</StackTrace><Type>System.Configuration.ConfigurationErrorsException</Type></InnerException><Message>The type initializer for 'System.Data.Entity.Internal.AppConfig' threw an exception.</Message>
<StackTrace> at System.Data.Entity.DbContext..ctor(String nameOrConnectionString)
at service1..ctor(Boolean proxyCreationEnabled)
at service1.ValidateUserIT()
at service1.GetTickets_ForDashBoard()
at SyncInvokeGetTickets_ForDashBoard(Object , Object[] , Object[] )
at System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]& outputs)
at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage31(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)</StackTrace><Type>System.TypeInitializationException</Type></ExceptionDetail></detail></s:Fault></s:Body></s:Envelope>
a:InternalServiceFaultSystem.Data.Entity.Internal.AppConfig的类型初始值设定项引发异常。
无法加载文件或程序集的EntityFramework,版本=6.0.0.0,区域性=中性,
PublicKeyToken=b77a5d561934e089'或其依赖项之一。定位的程序集清单定义与程序集引用不匹配。(来自HRESULT的异常:0x8013100)
在System.Configuration.TypeUtil.GetTypeWithReflectionPermission(IInternalConfigHost主机、字符串typeString、布尔throwOnError)和#xD;
在System.Configuration.RuntimeConfigurationRecord.RuntimeConfigurationFactory.Init(RuntimeConfigurationRecord configRecord,FactoryRecord FactoryRecord)和#xD;
在System.Configuration.RuntimeConfigurationRecord.RuntimeConfigurationFactory.InitWithRestrictedPermissions(RuntimeConfigurationRecord configRecord,FactoryRecord FactoryRecord)和#xD;
在System.Configuration.RuntimeConfigurationRecord.CreateSectionFactory(FactoryRecord FactoryRecord)和#xD;
在System.Configuration.BaseConfigurationRecord.FindAndensureRefactoryRecord(字符串configKey、布尔值和isRootDeclaredHere)System.IO.FileLoadException
创建entityFramework的配置节处理程序时出错:无法加载文件或程序集“entityFramework,版本=6.0.0.0,区域性=中性,PublicKeyToken=b77a5d561934e089”或其依赖项之一。
定位的程序集清单定义与程序集引用不匹配。(HRESULT的异常:0x8013100)(C:\inetpub\wwwroot\apps.sysinformation.net\HelpDesk\web.config第5行)位于System.Configuration。
BaseConfigurationRecord.find确保重构记录(字符串configKey、布尔值和isRootDeclaredHere)和xD;
在System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String configKey、Boolean getLkg、Boolean checkPermission、Boolean getRuntimeObject、Boolean RequestsHere、Object&result、Object&resultRuntimeObject)和;
在System.Configuration.BaseConfigurationRecord.GetSection(字符串configKey)和#xD;
在System.Data.Entity.Internal.AppConfig..ctor()和#xD;
在System.Data.Entity.Internal.AppConfig..cctor()System.Configuration.ConfigurationErrorsException中,“System.Data.Entity.Internal.AppConfig”的类型初始值设定项引发异常。
在System.Data.Entity.DbContext..ctor(字符串名称或连接字符串)和#xD;
在服务1..ctor(布尔proxyCreationEnabled)和#xD;
在service1.ValidateUserIT()和#xD;
在service1.GetTickets_ForDashBoard()和#xD;
在SyncInvokeGetTickets_ForDashBoard(对象,对象[],对象[])和#xD;
在System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(对象实例、对象[]输入、对象[]输出)和#xD;
在System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc&;rpc)和#xD;
在System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc&;rpc)和#xD;
在System.ServiceModel.Dispatcher.ImmutableDispatcheRuntime.ProcessMessage31(MessageRpc&;rpc)和#xD;
位于System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)System.TypeInitializationException
您是否发布了Entity Framework DLL的6.0版?查看您的内部异常:“无法加载文件或程序集的EntityFramework,版本=6.0.0.0,区域性=neutral,PublicKeyToken=b77a5d561934e089”或其某个依赖项。找到的程序集的清单定义与程序集引用不匹配。”是的,我已检查实体框架DLL,版本仅为6.0.0.0。只是为了澄清,假设某些DLL丢失或指向以前的版本,则该服务根本不应该工作。但就我而言,这项服务可以正常工作几个小时。还有一件事是,当服务停止时,如果我们再次复制并替换同一个web配置文件,服务可以正常工作,但只有几个小时。