I am trying to deploy an MVC app to an EC2 instance using Web Deploy, and everything is working until I try to run the application. I get the following error:
Parser Error Message: An error occurred creating the configuration section handler for entityFramework: Configuration for DbContext type 'Project.Modules.AppDbContext, Project' is specified multiple times in the application configuration. Each context can only be configured once.
I have looked all of the related issues I could find (error There is a duplicate 'entityFramework' section defined, There is a duplicate 'entityFramework' section defined - EntityFramework6 upgrade, The type initializer for 'System.Data.Entity.Internal.AppConfig' threw an exception, The provider for invariant name System.Data.SqlClient is specified multiple times). It is an MVC app so there are multiple Web.config files, but the EF section it is complaining about doesn't exist in both places. Here are the relevant portions of my config file:
<configSections>
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections>
--------more config settings here---------
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework">
<parameters>
<parameter value="Data Source=MYIP;Initial Catalog=db;Persist Security Info=True;User ID=user;Password=password" />
</parameters>
</defaultConnectionFactory>
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
</providers>
</entityFramework>
I have heard anything from it should be resolved in 6.1.0 to many other things. If I remove the entry from the configSection it gives me another error about how it can't find the right resources. The only other thing that might be worth noting is that if I deploy and un-check 'Execute Code First Migrations' it just times out instead of giving me the above error.