ASP.NET成员为MySQL /角色提供者? [英] ASP.NET Membership/Role providers for MySQL?
问题描述
我一点都不熟悉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 /净的6.2.2.0版本,请按照下列步骤...
Got it figured out! Using version 6.2.2.0 of MySql Connector/Net, follow these steps...
- 添加引用MySql.Web.dll
-
更改
<&籍GT;
在web.config中这样:
- Add reference to MySql.Web.dll
Change your
<membership>
in web.config to this:
<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>
这篇关于ASP.NET成员为MySQL /角色提供者?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!