如果你用的mysql connection 版本不同,则对应修改其中的版本号即可。找不到引用就添加相应引用。
<connectionStrings>
<remove name=”LocalMySqlServer”/>
<add name=”LocalMySqlServer” connectionString=”Datasource=localhost;uid=root;Pwd=password;database=testdb;” providerName=”MySql.Data.MySqlClient”/>
</connectionStrings>
<system.web>
<membership defaultProvider=”MySqlMembershipProvider”>
<providers>
<clear />
<add name=”MySqlMembershipProvider”
type=”MySql.Web.Security.MySQLMembershipProvider,
MySql.Web,Version=6.5.4.0,
Culture=neutral,
PublicKeyToken=c5687fc88969c44d”
connectionStringName=”LocalMySqlServer”
enablePasswordRetrieval=”false”
enablePasswordReset=”true”
requiresQuestionAndAnswer=”false”
requiresUniqueEmail=”true”
passwordFormat=”Hashed”
maxInvalidPasswordAttempts=”5″
minRequiredPasswordLength=”6″
minRequiredNonalphanumericCharacters=”0″
passwordAttemptWindow=”10″
applicationName=”/”
autogenerateschema=”true” />
</providers>
</membership>
<profile>
<providers>
<clear />
<add type=”MySql.Web.Security.MySQLProfileProvider,
MySql.Web,Version=6.5.4.0,
Culture=neutral,
PublicKeyToken=c5687fc88969c44d”
name=”MySqlProfileProvider”
applicationName=”/”
connectionStringName=”LocalMySqlServer”
autogenerateschema=”true” />
</providers>
</profile>
<roleManager enabled=”true” defaultProvider=”MySqlRoleProvider”>
<providers>
<clear />
<add connectionStringName=”LocalMySqlServer”
applicationName=”/”
name=”MySqlRoleProvider”
type=”MySql.Web.Security.MySQLRoleProvider,
MySql.Web,Version=6.5.4.0,
Culture=neutral,PublicKeyToken=c5687fc88969c44d”
autogenerateschema=”true” />
</providers>
</roleManager>
</system.web>
参考:
1. http://www.codeproject.com/Articles/117157/Setting-up-MySql-Membership-with-Visual-Studio-201
2. http://blog.bisoyi.com/post/2012/04/07/Using-MySql-Membership-Provider-in-ASPNet-MVC.aspx