title: The type initializer for 'System.Data.Entity.Internal.AppConfig' threw an exception in WCF RIA Services
body: <p>I have recently updated EntityFramework in my Wcf Application from v5 to v6.  After publishing  the service , service works fine for few hours. Later all services throws an exception like below, I tried all the solutions that are suggested , please Can any one  help me,</p>
  
  <pre><code>&lt;s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"&gt;&lt;s:Body&gt;&lt;s:Fault&gt;&lt;faultcode xmlns:a="http://schemas.microsoft.com/net/2005/12/windowscommunicationfoundation/dispatcher"&gt;
  a:InternalServiceFault&lt;/faultcode&gt;&lt;faultstring xml:lang="en-US"&gt;The type initializer for 'System.Data.Entity.Internal.AppConfig' threw an exception.&lt;/faultstring&gt;&lt;detail&gt;
  &lt;ExceptionDetail xmlns="http://schemas.datacontract.org/2004/07/System.ServiceModel" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"&gt;&lt;HelpLink i:nil="true"/&gt;&lt;InnerException&gt;
  &lt;HelpLink i:nil="true"/&gt;&lt;InnerException&gt;&lt;HelpLink i:nil="true"/&gt;&lt;InnerException i:nil="true"/&gt;&lt;Message&gt;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)&lt;/Message&gt;
  &lt;StackTrace&gt;   at System.Configuration.TypeUtil.GetTypeWithReflectionPermission(IInternalConfigHost host, String typeString, Boolean throwOnError)&amp;#xD;
     at System.Configuration.RuntimeConfigurationRecord.RuntimeConfigurationFactory.Init(RuntimeConfigurationRecord configRecord, FactoryRecord factoryRecord)&amp;#xD;
     at System.Configuration.RuntimeConfigurationRecord.RuntimeConfigurationFactory.InitWithRestrictedPermissions(RuntimeConfigurationRecord configRecord, FactoryRecord factoryRecord)&amp;#xD;
     at System.Configuration.RuntimeConfigurationRecord.CreateSectionFactory(FactoryRecord factoryRecord)&amp;#xD;
     at System.Configuration.BaseConfigurationRecord.FindAndEnsureFactoryRecord(String configKey, Boolean&amp;amp; isRootDeclaredHere)&lt;/StackTrace&gt;&lt;Type&gt;System.IO.FileLoadException&lt;/Type&gt;&lt;/InnerException&gt;
  &lt;Message&gt;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)&lt;/Message&gt;&lt;StackTrace&gt;   at System.Configuration.
  BaseConfigurationRecord.FindAndEnsureFactoryRecord(String configKey, Boolean&amp;amp; isRootDeclaredHere)&amp;#xD;
     at System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean requestIsHere, Object&amp;amp; result, Object&amp;amp; resultRuntimeObject)&amp;#xD;
     at System.Configuration.BaseConfigurationRecord.GetSection(String configKey)&amp;#xD;
     at System.Data.Entity.Internal.AppConfig..ctor()&amp;#xD;
     at System.Data.Entity.Internal.AppConfig..cctor()&lt;/StackTrace&gt;&lt;Type&gt;System.Configuration.ConfigurationErrorsException&lt;/Type&gt;&lt;/InnerException&gt;&lt;Message&gt;The type initializer for 'System.Data.Entity.Internal.AppConfig' threw an exception.&lt;/Message&gt;
  &lt;StackTrace&gt;   at System.Data.Entity.DbContext..ctor(String nameOrConnectionString)&amp;#xD;
     at service1..ctor(Boolean proxyCreationEnabled)&amp;#xD;
     at service1.ValidateUserIT()&amp;#xD;
     at service1.GetTickets_ForDashBoard()&amp;#xD;
     at SyncInvokeGetTickets_ForDashBoard(Object , Object[] , Object[] )&amp;#xD;
     at System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]&amp;amp; outputs)&amp;#xD;
     at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc&amp;amp; rpc)&amp;#xD;
     at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc&amp;amp; rpc)&amp;#xD;
     at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage31(MessageRpc&amp;amp; rpc)&amp;#xD;
     at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)&lt;/StackTrace&gt;&lt;Type&gt;System.TypeInitializationException&lt;/Type&gt;&lt;/ExceptionDetail&gt;&lt;/detail&gt;&lt;/s:Fault&gt;&lt;/s:Body&gt;&lt;/s:Envelope&gt;        
  </code></pre>