title: ASP.NET cannot enable migrations
body: <p>I am having a problem enabling migrations on my ASP.net MVC project. 
  Anybody help please. 
  error is as following:</p>
  
  <pre><code>PM&gt; Enable-Migrations -ContextTypeName HRHR.Models.ListofvacanciesEntities Checking if the context targets an existing database... 
  System.TypeInitializationException: The type initializer for 'System.Data.Entity.Migrations.DbMigrationsConfiguration`1' threw an exception.
  ---&gt; System.TypeInitializationException: The type initializer for 'System.Data.Entity.Internal.AppConfig' threw an exception. 
  ---&gt; System.Configuration.ConfigurationErrorsException: Configuration system failed to initialize 
  ---&gt; System.Configuration.ConfigurationErrorsException: Unrecognized configuration section compilation. (C:\Users\Taras\documents\visual studio 2015\Projects\HRHR\HRHR\tmpAE68.tmp line 7)
         at System.Configuration.ConfigurationSchemaErrors.ThrowIfErrors(Boolean ignoreLocal)
         at System.Configuration.BaseConfigurationRecord.ThrowIfParseErrors(ConfigurationSchemaErrors schemaErrors)
         at System.Configuration.BaseConfigurationRecord.ThrowIfInitErrors()
         at System.Configuration.ClientConfigurationSystem.EnsureInit(String configKey)
         --- End of inner exception stack trace ---
         at System.Configuration.ClientConfigurationSystem.EnsureInit(String configKey)
         at System.Configuration.ClientConfigurationSystem.PrepareClientConfigSystem(String sectionName)
         at System.Configuration.ClientConfigurationSystem.System.Configuration.Internal.IInternalConfigSystem.GetSection(String sectionName)
         at System.Configuration.ConfigurationManager.get_ConnectionStrings()
         at System.Data.Entity.Internal.AppConfig..ctor()
         at System.Data.Entity.Internal.AppConfig..cctor()
         --- End of inner exception stack trace ---
         at System.Data.Entity.Infrastructure.DependencyResolution.DbConfigurationManager.EnsureLoadedForAssembly(Assembly assemblyHint, Type contextTypeHint)
         at System.Data.Entity.Infrastructure.DependencyResolution.DbConfigurationManager.EnsureLoadedForContext(Type contextType)
         at System.Data.Entity.Migrations.DbMigrationsConfiguration`1..cctor()
         --- End of inner exception stack trace ---
         at System.Data.Entity.Migrations.DbMigrationsConfiguration`1..ctor()
         at HRHR.Migrations.Configuration..ctor() in C:\Users\Taras\documents\visual studio 2015\Projects\HRHR\HRHR\Migrations\Configuration.cs:line 10
      --- End of stack trace from previous location where exception was thrown ---
         at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
         at System.Data.Entity.Migrations.Utilities.MigrationsConfigurationFinder.FindMigrationsConfiguration(Type contextType, String configurationTypeName, Func`2 noType, Func`3 multipleTypes, Func`3 noTypeWithName, Func`3 multipleTypesWithName)
         at System.Data.Entity.Migrations.Design.ToolingFacade.BaseRunner.FindConfiguration()
         at System.Data.Entity.Migrations.Design.ToolingFacade.ScaffoldRunner.Run()
         at System.AppDomain.DoCallBack(CrossAppDomainDelegate callBackDelegate)
         at System.AppDomain.DoCallBack(CrossAppDomainDelegate callBackDelegate)
         at System.Data.Entity.Migrations.Design.ToolingFacade.Run(BaseRunner runner)
         at System.Data.Entity.Migrations.Design.ToolingFacade.ScaffoldInitialCreate(String language, String rootNamespace)
         at System.Data.Entity.Migrations.EnableMigrationsCommand.&lt;&gt;c__DisplayClass2.&lt;.ctor&gt;b__0()
         at System.Data.Entity.Migrations.MigrationsDomainCommand.Execute(Action command)
      The type initializer for 'System.Data.Entity.Migrations.DbMigrationsConfiguration`1' threw an exception.
  </code></pre>
  
  <p><strong>This is my Configuration.cs:</strong></p>
  
  <pre><code>namespace HRHR.Migrations
  {
      using System;
      using System.Data.Entity;
      using System.Data.Entity.Migrations;
      using System.Linq;
  
      internal sealed class Configuration : DbMigrationsConfiguration&lt;HRHR.Models.ListofvacanciesEntities&gt;
      {
          public Configuration()
          {
              AutomaticMigrationsEnabled = false;
          }
  
          protected override void Seed(HRHR.Models.ListofvacanciesEntities context)
          {
              //  This method will be called after migrating to the latest version.
  
              //  You can use the DbSet&lt;T&gt;.AddOrUpdate() helper extension method 
              //  to avoid creating duplicate seed data. E.g.
              //
              //    context.People.AddOrUpdate(
              //      p =&gt; p.FullName,
              //      new Person { FullName = "Andrew Peters" },
              //      new Person { FullName = "Brice Lambson" },
              //      new Person { FullName = "Rowan Miller" }
              //    );
              //
          }
      }
  }
  </code></pre>
  
  <p><strong>This is my Web.config file:</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;!--
    For more information on how to configure your ASP.NET application, please visit
    http://go.microsoft.com/fwlink/?LinkId=301880
    --&gt;
  &lt;configuration&gt;
    &lt;compilation debug="true" targetFramework="4.5"&gt;
      &lt;assemblies&gt;
        &lt;add assembly="WebMatrix.Data, Version=2.0.0.0, Culture=neutral,    PublicKeyToken=31bf3856ad364e35" /&gt;
        &lt;add assembly="WebMatrix.WebData, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" /&gt;
      &lt;/assemblies&gt;
    &lt;/compilation&gt;
    &lt;configSections&gt;
      &lt;!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 --&gt;
      &lt;section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /&gt;
    &lt;/configSections&gt;
    &lt;connectionStrings&gt;
      &lt;!--&lt;add name="DefaultConnection" connectionString="Data Source=(LocalDb)\MSSQLLocalDB;AttachDbFilename=|DataDirectory|\aspnet-HRHR-20160427123011.mdf;Initial Catalog=aspnet-HRHR-20160427123011;Integrated Security=True" providerName="System.Data.SqlClient" /&gt;--&gt;
      &lt;add name="ListofvacanciesEntities" connectionString="metadata=res://*/Models.DataForSystem.csdl|res://*/Models.DataForSystem.ssdl|res://*/Models.DataForSystem.msl;provider=System.Data.SqlClient;provider connection string=&amp;quot;data source=.\SQLEXPRESS;initial catalog=Listofvacancies;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework&amp;quot;" providerName="System.Data.EntityClient" /&gt;
    &lt;/connectionStrings&gt;
  
    &lt;appSettings&gt;
      &lt;add key="webpages:Version" value="3.0.0.0" /&gt;
      &lt;add key="webpages:Enabled" value="false" /&gt;
      &lt;add key="ClientValidationEnabled" value="true" /&gt; 
      &lt;add key="UnobtrusiveJavaScriptEnabled" value="true" /&gt;    
    &lt;/appSettings&gt;
    &lt;system.web&gt;
      &lt;authentication mode="None" /&gt;
      &lt;compilation debug="true" targetFramework="4.6.1" /&gt;
      &lt;httpRuntime targetFramework="4.6.1" /&gt;
    &lt;/system.web&gt;
    &lt;system.webServer&gt;
      &lt;modules&gt;
        &lt;remove name="FormsAuthentication" /&gt;
      &lt;/modules&gt;
    &lt;/system.webServer&gt;
    &lt;runtime&gt;
      &lt;assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"&gt;
        &lt;dependentAssembly&gt;
          &lt;assemblyIdentity name="Microsoft.Owin.Security" publicKeyToken="31bf3856ad364e35" /&gt;
          &lt;bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0" /&gt;
        &lt;/dependentAssembly&gt;
        &lt;dependentAssembly&gt;
          &lt;assemblyIdentity name="Microsoft.Owin.Security.OAuth" publicKeyToken="31bf3856ad364e35" /&gt;
          &lt;bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0" /&gt;
        &lt;/dependentAssembly&gt;
        &lt;dependentAssembly&gt;
          &lt;assemblyIdentity name="Microsoft.Owin.Security.Cookies" publicKeyToken="31bf3856ad364e35" /&gt;
          &lt;bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0" /&gt;
        &lt;/dependentAssembly&gt;
        &lt;dependentAssembly&gt;
          &lt;assemblyIdentity name="Microsoft.Owin" publicKeyToken="31bf3856ad364e35" /&gt;
          &lt;bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0" /&gt;
        &lt;/dependentAssembly&gt;
        &lt;dependentAssembly&gt;
          &lt;assemblyIdentity name="Newtonsoft.Json" culture="neutral" publicKeyToken="30ad4fe6b2a6aeed" /&gt;
          &lt;bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" /&gt;
        &lt;/dependentAssembly&gt;
        &lt;dependentAssembly&gt;
          &lt;assemblyIdentity name="System.Web.Optimization" publicKeyToken="31bf3856ad364e35" /&gt;
          &lt;bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="1.1.0.0" /&gt;
        &lt;/dependentAssembly&gt;
        &lt;dependentAssembly&gt;
          &lt;assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" /&gt;
          &lt;bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" /&gt;
        &lt;/dependentAssembly&gt;
        &lt;dependentAssembly&gt;
          &lt;assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" /&gt;
          &lt;bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" /&gt;
        &lt;/dependentAssembly&gt;
        &lt;dependentAssembly&gt;
          &lt;assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" /&gt;
          &lt;bindingRedirect oldVersion="1.0.0.0-5.2.3.0" newVersion="5.2.3.0" /&gt;
        &lt;/dependentAssembly&gt;
        &lt;dependentAssembly&gt;
          &lt;assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" /&gt;
          &lt;bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" /&gt;
        &lt;/dependentAssembly&gt;
        &lt;dependentAssembly&gt;
          &lt;assemblyIdentity name="WebMatrix.Data" publicKeyToken="31bf3856ad364e35" culture="neutral" /&gt;
          &lt;bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" /&gt;
        &lt;/dependentAssembly&gt;
        &lt;dependentAssembly&gt;
          &lt;assemblyIdentity name="System.Web.WebPages.Razor" publicKeyToken="31bf3856ad364e35" culture="neutral" /&gt;
          &lt;bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" /&gt;
        &lt;/dependentAssembly&gt;
      &lt;/assemblyBinding&gt;
    &lt;/runtime&gt;
    &lt;entityFramework&gt;
      &lt;defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" /&gt;
      &lt;providers&gt;
        &lt;provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" /&gt;
      &lt;/providers&gt;
    &lt;/entityFramework&gt;
    &lt;system.codedom&gt;
      &lt;compilers&gt;
        &lt;compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:6 /nowarn:1659;1699;1701" /&gt;
        &lt;compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:14 /nowarn:41008 /define:_MYTYPE=\&amp;quot;Web\&amp;quot; /optionInfer+" /&gt;
      &lt;/compilers&gt;
    &lt;/system.codedom&gt;
  
  &lt;/configuration&gt;
  </code></pre>
  
  <p><a href="http://i.stack.imgur.com/9O4dm.jpg" rel="nofollow">my solution explorer</a></p>