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.
我使用LINQ to SQL实现了自定义成员资格提供程序。当我在Web配置中将成员资格提供程序添加到我的asp.net mvc网站时,登录页面停止工作。
My Web.config setup:
我的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>
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.
我使用的是asp.net mvc默认项目附带的标准会员代码。成员资格提供程序在Web项目中包含的单独程序集中实现。
Any help would be greatly appreciated.
任何帮助将不胜感激。
Thanks!
谢谢!
2 个解决方案
#1
26
Try adding "Default=MyMembershipProvider" in the membership tag. If you don't specify the default, it will try to use the ASP standard.
尝试在成员资格标记中添加“Default = MyMembershipProvider”。如果未指定默认值,则会尝试使用ASP标准。
#2
3
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.
你可以试试2件事。第一:可以调试,只需中断所有异常并下载调试符号,包括.NET框架的源代码。
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
第二个:因为你的类型是在另一个程序集中定义的,所以类型中的字符串可能需要是一个程序集限定类型的字符串,即它就像
type="MyMembership.MyMembershipProvider, MyAssemblyName"
#1
26
Try adding "Default=MyMembershipProvider" in the membership tag. If you don't specify the default, it will try to use the ASP standard.
尝试在成员资格标记中添加“Default = MyMembershipProvider”。如果未指定默认值,则会尝试使用ASP标准。
#2
3
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.
你可以试试2件事。第一:可以调试,只需中断所有异常并下载调试符号,包括.NET框架的源代码。
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
第二个:因为你的类型是在另一个程序集中定义的,所以类型中的字符串可能需要是一个程序集限定类型的字符串,即它就像
type="MyMembership.MyMembershipProvider, MyAssemblyName"