Click here to Skip to main content
15,891,184 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
<?xml version="1.0" encoding="utf-8"?>

<configuration>
  <appSettings>

  </appSettings>
  <startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
  </startup>
  <connectionStrings>
    <add name="FeedAccountEntities" connectionString="metadata=res://*/FeedAccountsDetails.csdl|res://*/FeedAccountsDetails.ssdl|res://*/FeedAccountsDetails.msl;provider=System.Data.SqlClient;provider connection string='data source=NGWS23\SQLEXPRESS;initial catalog=FeedAccount;persist security info=True;user id=sa;MultipleActiveResultSets=True;App=EntityFramework'" providerName="System.Data.EntityClient" />

  </connectionStrings>

  <configSections>
    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
  </configSections>
  <entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />

  </entityFramework>

</configuration>
Posted
Comments
Richard Deeming 5-Mar-15 7:04am    
A TypeInitializationException will have an InnerException which contains the important details.

Just remove the provider under the entityFramwork section, It worked for me

XML
<providers>
  <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
</providers>
 
Share this answer
 
Comments
Alexander Immanuel D 5-Sep-16 13:16pm    
Wow that worked for me!! Thanks!
pproost@hotmail.com 24-Oct-16 4:20am    
This also works for me, do you know what the reason is for the error or why the fix works?
Hi,

Your App.config file has Entity Framework 6.0 listed, and some project in your code is still holding onto EF with an older version and expecting to find it in the App.config file. Or vice versa.

Check for the versions
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900