Entityframework error

Asked

Viewed 90 times

1

Could someone help me ? I’m trying to do Codefirst and when I execute the command I get this error:

The 'System.Data.Entity.Internal.Appconfig' type initializer triggered an exception.

My Appconfig is like this:

<?xml version="1.0" encoding="utf-8"?>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<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>
  <connectionStrings>
    <add name="MusicasDbConexto" providerName="MySql.Data.MySqlClient" connectionString="server=localhost;Database=musica;uid=root;pwd=''" />
  </connectionStrings>

  <entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
    <providers>
      <provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6" />
      <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
      <provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6, Version=6.9.12.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d"></provider>
    </providers>
  </entityFramework>

  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>

        <assemblyIdentity name="MySql.Data" publicKeyToken="c5687fc88969c44d" culture="neutral" />

        <bindingRedirect oldVersion="0.0.0.0-8.0.17.0" newVersion="8.0.17.0" />

      </dependentAssembly>

    </assemblyBinding>

  </runtime>
</configuration>
  • 1

    Hello! Could you enter the exception description added by System.Data.Entity.Internal.Appconfig? Apparently your Appconfig file is ok, but other things could be causing this error. For example: with your database, with your context class, with the types of your model, among others. Note these points and even the version of your Entity Framework.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.