I\'m working with EF5 in a MVC 4 aspnet website. Locally, everything works just fine, but when I publish it to the IIS and try to enter, I get the error
in my case
<section name="entityFramework"
must be updated from version 4 to 6. I mean a project was updated EntityFramework from 4 to 6 but web.config was not updated.
If you are maintaining one more cinfiguration file for app.config , Don't include any key in parent page.
Parent Page : app.config
<appSettings configSource="appSettings.config">
<add key="ClientSettings" value="venice" /> <!-- Don't add Key Here -->
</appSettings>
Child Page : appSettings.config
<appSettings>
<add key="ClientSettings" value="venice"/> <!-- add Here -->
</appSettings>
I had same problem. After one day, I got it.
Problem was from adding two smtp
tags in mailSettings
under <system.net>
.
I needed to change by defaultConnectionFactory to be SqlConnectionFactory instead of the default
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework">
<parameters>
<parameter value="<My Connection String>" />
</parameters>
</defaultConnectionFactory>
</entityFramework>
http://blogs.msdn.com/b/davidobando/archive/2012/08/14/changing-ef-s-default-provider-from-localdb-to-sql-server.aspx
Do the following in the App.config file,
connectionStrings
element is after the configSections
element.startup
element after the connectionStrings
element.<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=4.3.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
</configSections>
<connectionStrings>
<add name="SchedulingContext" connectionString="Data Source=XXX\SQL2008R2DEV;Initial Catalog=YYY;Persist Security Info=True;User ID=sa;Password=XXX" providerName="System.Data.SqlClient"/>
</connectionStrings>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
</configuration>
If you use ASP.NET and IISExpress go to "C:\Users\\Documents\IISExpress\config\applicationhost.config", search for your Project and look if you have a faulty virtualDirectory entry.