InnerException : Table 'xxx.aspnetusers' doesn't exist

asp.net-mvc-4 entity-framework-6 mysql sql

Question

I have an ASP.NET MVC 4 Web API project which uses Entity Framework 6.1.1 and MySQL 6.9.5.0. When I call /api/Account/Register using DHC, the code breaks at

IdentityResult result = await UserManager.CreateAsync(user, model.Password);

in the AccountController and I get an InnerException which says

Table 'xxx.aspnetusers' doesn't exist

Here are pieces of my web.config

<connectionStrings>
<add name="ClockitDb" connectionString="Data Source=ClockitDb;port=3306;Initial Catalog=ClockitDb;Server=localhost;user id=root;password=m916600026;"
  providerName="MySql.Data.MySqlClient" />
</connectionStrings>

<!-- Some code-->

<entityFramework codeConfigurationType="MySql.Data.Entity.MySqlEFConfiguration, MySql.Data.Entity.EF6">
<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" />
</providers> 
</entityFramework>

<!-- Some code-->

<system.web>

<authentication mode="Forms" />
<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5" />
<membership defaultProvider="MySQLMembershipProvider">
  <providers>
    <remove name="MySQLMembershipProvider" />
    <add name="MySQLMembershipProvider" type="MySql.Web.Security.MySQLMembershipProvider, MySql.Web, Version=6.9.5.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" connectionStringName="LocalMySqlServer" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="true" applicationName="/" requiresUniqueEmail="false" passwordFormat="Clear" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="7" minRequiredNonalphanumericCharacters="1" passwordAttemptWindow="10" passwordStrengthRegularExpression="" />
  </providers>
</membership>
<profile defaultProvider="MySQLProfileProvider">
  <providers>
    <remove name="MySQLProfileProvider" />
    <add name="MySQLProfileProvider" type="MySql.Web.Profile.MySQLProfileProvider, MySql.Web, Version=6.9.5.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" connectionStringName="LocalMySqlServer" applicationName="/" />
  </providers>
</profile>
<roleManager defaultProvider="MySQLRoleProvider">
  <providers>
    <remove name="MySQLRoleProvider" />
    <add name="MySQLRoleProvider" type="MySql.Web.Security.MySQLRoleProvider, MySql.Web, Version=6.9.5.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" connectionStringName="LocalMySqlServer" applicationName="/" />
  </providers>
</roleManager>
<siteMap defaultProvider="MySqlSiteMapProvider">
  <providers>
    <remove name="MySqlSiteMapProvider" />
    <add name="MySqlSiteMapProvider" type="MySql.Web.SiteMap.MySqlSiteMapProvider, MySql.Web, Version=6.9.5.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" connectionStringName="LocalMySqlServer" applicationName="/" />
  </providers>
</siteMap>
<webParts>

<personalization defaultProvider="MySQLPersonalizationProvider">
    <providers>
      <remove name="MySQLPersonalizationProvider" />
      <add name="MySQLPersonalizationProvider" type="MySql.Web.Personalization.MySqlPersonalizationProvider, MySql.Web, Version=6.9.5.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" connectionStringName="LocalMySqlServer" applicationName="/" />
    </providers>
  </personalization>
</webParts>

<entityFramework codeConfigurationType="MySql.Data.Entity.MySqlEFConfiguration, MySql.Data.Entity.EF6">
<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" />
</providers>

1
8
1/15/2015 6:08:50 AM

Popular Answer

I had exactly the same problem . I followed the following tutorial and it worked How to set up application using ASP.NET Identity with MySQL Provider

It is important that you follow all the steps of the tutorial,even the migration setup, otherwise it gives the same error.

4
1/18/2015 8:20:09 PM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow