我在asp.net 4中有自定义成员资格提供程序。它是:
public class CustomMembershipProvider : SqlMembershipProvider
{
}
和自定义角色提供程序:
public class CustomRoleProvider : RoleProvider
{
}
我在web.config中使用此代码设置自定义成员资格:
<membership defaultProvider="CustomMembershipProvider">
<providers>
<clear/>
<add name="CustomMembershipProvider" type="Login1.Code.CustomMembershipProvider" connectionStringName="LoginDB1Entities" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="/" />
</providers>
</membership>
<roleManager enabled="true" defaultProvider="CustomRoleProvider">
<providers>
<clear/>
<add name="CustomRoleProvider" type="Login1.Code.CustomRoleProvider" connectionStringName="LoginDB1Entities" applicationName="/" />
<add name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider" applicationName="/" />
</providers>
</roleManager>
<profile>
<providers>
<clear/>
<add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="ApplicationServices" applicationName="/" />
</providers>
</profile>
和这个连接字符串:
<connectionStrings>
<add name="LoginDB1Entities" connectionString="metadata=res://*/Code.EFModel.csdl|res://*/Code.EFModel.ssdl|res://*/Code.EFModel.msl;provider=System.Data.SqlClient;provider connection string="Data Source=.;Initial Catalog=LoginDB1;Integrated Security=True;MultipleActiveResultSets=True"" providerName="System.Data.EntityClient" />
</connectionStrings>
我的应用程序在localhost中工作,但我在主机中使用此站点并收到此错误: '/'应用程序中的服务器错误。