我对 ASP.NET 成员资格/角色一点也不熟悉.这是我第一次使用它,也是我第一次尝试 ASP.NET MVC.当我为 MVC 创建我的第一个项目时,它给了我一个可爱的模板来创建一个帐户.我很高兴看到我不必手动执行此操作.但是,它失败了,因为它无法连接到 SQL Server.我没有 SQL Server,我有 MySQL.有什么简单的方法可以让这个系统改用 MySQL,还是我必须创建自己的身份验证?
I am not at all familiar with ASP.NET membership/roles. This is my first time using it, and my first time trying ASP.NET MVC. When I create my first project for MVC, it gives me a lovely template to create an account. I was excited to see that I did not have to do this manually. However, it failed because it cannot connect to SQL Server. I do not have SQL Server, I have MySQL. Is there any easy way I can get this system to use MySQL instead, or will I have to create my own authentication?
明白了!使用 MySql Connector/Net 的 6.2.2.0 版,请按照以下步骤操作...
Got it figured out! Using version 6.2.2.0 of MySql Connector/Net, follow these steps...
将您在 web.config 中的
更改为:
<membership defaultProvider="MySqlMembershipProvider">
<providers>
<clear/>
<add name="MySqlMembershipProvider"
type="MySql.Web.Security.MySQLMembershipProvider,
MySql.Web, Version=6.2.2.0, Culture=neutral,
PublicKeyToken=c5687fc88969c44d"
autogenerateschema="true"
connectionStringName="NAME_OF_YOUR_CONN_STRING"
enablePasswordRetrieval="false"
enablePasswordReset="true"
requiresQuestionAndAnswer="false"
requiresUniqueEmail="false"
passwordFormat="Hashed"
maxInvalidPasswordAttempts="5"
minRequiredPasswordLength="6"
minRequiredNonalphanumericCharacters="0"
passwordAttemptWindow="10"
passwordStrengthRegularExpression=""
applicationName="/"
/>
</providers>
</membership>
这篇关于MySQL 的 ASP.NET 成员资格/角色提供程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!