ASP.NET MVC 自定义成员资格提供程序 Web.config 错误
我已经使用 LINQ to SQL 实现了自定义成员资格提供程序。 当我在 Web 配置中将会员资格提供程序添加到我的 asp.net mvc 网站时,登录页面停止工作。
我的 Web.config 设置:
<membership>
<providers>
<clear/>
<add
name="MyMembershipProvider"
type="MyMembership.MyMembershipProvider"
connectionStringName="ApplicationServices"
enablePasswordRetrieval="false"
enablePasswordReset="true"
requiresQuestionAndAnswer="false"
requiresUniqueEmail="false"
passwordFormat="Hashed"
maxInvalidPasswordAttempts="5"
minRequiredPasswordLength="6"
minRequiredNonalphanumericCharacters="0"
passwordAttemptWindow="10"
passwordStrengthRegularExpression=""
applicationName="/"/>
</providers>
</membership>
我收到的错误如下:
解析器错误消息:找不到默认成员资格提供程序。
来源错误:
Line 53: <forms loginUrl="~/Account/LogOn" timeout="2880"/>
Line 54: </authentication>
Line 55: <membership>
Line 56: <providers>
Line 57: <clear/>
我不知道从这里继续哪里。 我无法设置断点,因为错误似乎是从主代码中调用的。
我正在使用 asp.net mvc 默认项目附带的标准会员代码。 成员资格提供程序在 Web 项目中包含的单独程序集中实现。
任何帮助将不胜感激。
谢谢!
I have implemented a custom membership provider using LINQ to SQL. When I added the Membership provider to my asp.net mvc website in the web config the logon page stopped working.
My Web.config setup:
<membership>
<providers>
<clear/>
<add
name="MyMembershipProvider"
type="MyMembership.MyMembershipProvider"
connectionStringName="ApplicationServices"
enablePasswordRetrieval="false"
enablePasswordReset="true"
requiresQuestionAndAnswer="false"
requiresUniqueEmail="false"
passwordFormat="Hashed"
maxInvalidPasswordAttempts="5"
minRequiredPasswordLength="6"
minRequiredNonalphanumericCharacters="0"
passwordAttemptWindow="10"
passwordStrengthRegularExpression=""
applicationName="/"/>
</providers>
</membership>
The error I get is the following:
Parser Error Message: Default Membership Provider could not be found.
Source Error:
Line 53: <forms loginUrl="~/Account/LogOn" timeout="2880"/>
Line 54: </authentication>
Line 55: <membership>
Line 56: <providers>
Line 57: <clear/>
I am stuck on where to proceed from here. I can't set a break point since the error seems to be called out of the main code.
I am using the standard membership code that comes with the default project of asp.net mvc. The membership provider is implemented in a separate assembly that is included in the web project.
Any help would be greatly appreciated.
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试在会员标签中添加“Default=MyMembershipProvider”。 如果不指定默认值,它将尝试使用 ASP 标准。
Try adding "Default=MyMembershipProvider" in the membership tag. If you don't specify the default, it will try to use the ASP standard.
有 2 件事你可以尝试。 第一:调试是可能的,只需中断所有异常并下载调试符号,包括 .NET 框架的源代码。
第二:由于您的类型是在另一个程序集中定义的,因此
type
中的字符串可能需要是程序集限定的类型字符串,即它就像2 things you can try. Number one: debugging is possible, just break on all exceptions and download the debug symbols including source code for the .NET framework.
Number two: since your type is defined in another assembly, the string in
type
probably needs to be an assembly qualified type string, i.e. it's like