30 July 2013

The type initializer for 'System.Data.Entity.Internal.AppConfig' threw an exception.

Have you experienced this when you update the database (Code First) using the Package Manager?

I have a simple solution.

I just add the below script in web.config

        <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />

and I made sure that the below script is present

    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />

And everything went fine.