<configuration>
<configSections>
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/>
<!-- For more information on Entity Framework configuration, visit
<sectionGroup name="dotNetOpenAuth" type="DotNetOpenAuth.Configuration.DotNetOpenAuthSection, DotNetOpenAuth.Core">
Hi i am getting the above error when i tried to run my project in MVC4.
Please let me know what should i do resolve this error.
I think the below suggestion would work (highlighted with **). Please let me know the result.
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=**6.0.0.0**, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/>
Related
I'm trying to launch the databaseinitializer but nothing happens. It used to work before I switched from MySql.Data.Entity.EF6 to the new one. I can write anything as the attribute type of context and it will still load the app but the database is never initialized.
Thanks
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
...
<entityFramework>
<contexts>
<context type="GroupeFleury.DAL.ApplicationDbContext, GroupeFleuryApps, Version=1.0.0.0, Culture=neutral">
<databaseInitializer type="GroupeFleury.DAL.DbInitialisateur, GroupeFleuryApps, Version=1.0.0.0, Culture=neutral" />
</context>
</contexts>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework"></defaultConnectionFactory>
<providers>
<provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.EntityFramework"/>
</providers>
I am trying to turn on database logging using the interceptor feature that was added in EF 6.1. It works fine when I turn on in a ASP.NET web.config file, but when I trying to use in a WCF service that uses EF 6.1, it gets the following error
Exception: System.ServiceModel.ServiceActivationException: The service '/DataAccessService.svc' cannot be activated due to an exception during compilation. The exception message is: The type initializer for 'System.Data.Entity.Internal.AppConfig' threw an exception..The more telling message is from the inner exception: Unrecognized element 'interceptors'. web.config line 123)
NOTE: based on the first answer, I am providing more elements from the web.config
<configuration>
<configSections>
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections>
.
.
.
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
</providers>
<interceptors>
<interceptor type="System.Data.Entity.Infrastructure.Interception.DatabaseLogger, EntityFramework">
<parameters>
<parameter value="C:\tmp\DataAccessLogOutput.txt" />
</parameters>
</interceptor>
</interceptors>
</entityFramework>
You didn't register the Entity Frame Work configuration section that defines <interceptors> correctly. In other words do you have this at the top of your config file?
<configuration>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework"
type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=4.3.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
</configSections>
</configuration>
I created a project from template which included EF 6.0.
I then updated the nuget packages and EF 6.1.1 is installed.
However in web.config i still have this:
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections>
All other dependent assemblies are updated correctly (i.e MVC e.t.c)
Should i have updated this myself?
That is the assembly version, and it stays at 6.0.0.0
I'm trying to get Entity Framework working with and Oracle database.
I originally had entity framework 6 installed but now I've downgraded to EF 5 because I've read EF6 doesn't work with ODP.NET.
<configSections>
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
</configSections>
This is my app config, config section. I've reinstalled EF 5 on all my projects but keep getting this error.
Have a class library and a WPF application and am trying to contain all the Entity Framework items within the class library and use an interface to get the info out. Everything is setup but I get this message each time I try it out:
Message "The type initializer for 'System.Data.Entity.Internal.AppConfig' threw an exception."
When I looked at the Inner Exceptions it appeared it couldn't find version 5.0.0.0 of EntityFramework and when I checked the Reference for it, it was 4.4.0.0. Tried uninstalling and reinstalling EntityFramework via NuGet but having no luck. Any ideas on what to try next?
App Config:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=4.4.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
</entityFramework>
</configuration>
I think this is a problem with your app.Config prehaps you dont have the following:
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=4.4.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
</entityFramework>
This needs to be in the config file for your application entry point (whatever executable/webapp is running/using your class library)
A key detail to note is that EF4.4 is released inside the EF5 package and is used for non-.NET 4.5 applications (ie if you have .net 4.5 your reference will be 5.0 otherwise with .net 4 it will be 4.4)
Uninstalled EntityFramework
Updated Class Library to .Net Version 4.5
Reinstalled EntityFramework
Now all working.
I have tried changing the version of EF in the webconfig to the current installed version of the EF on the project and everything works smoothly.