An unhandled exception of type 'System.TypeInitializationException' occurred in EntityFramework.dll
Read the message:
Only one
<configSections>
element allowed per config file and if present must be the first child of the root<configuration>
element.
Move the configSections element to the top - just above where system.data is currently.
Check which version of Entity Framework reference you have in your References and make sure that it matches with your configSections
node in Web.config
file. In my case it was pointing to version 5.0.0.0 in my configSections and my reference was 6.0.0.0. I just changed it and it worked...
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/>
Just go to Web.Config
from Main
folder, not the one in Views
Folder:
configSections
section name="entityFramework" type="System.Data. .....,Version=" <strong>5</strong>.0.0.0"..
<..>
ADJUST THE VERSION OF EntityFramework you have installed, ex. like Version 6.0.0.0"