0
我遇到了ASP.NET 4.0成員資格問題。我想在我的web.config文件中擁有所有的成員資格配置,而不是使用machine.config。我將成員資格存儲在名爲MYSERVER \ A的遠程SQL Server 2008 R2數據庫服務器中。這裏的web.config成員供應商的麻煩
<connectionStrings>
<clear/>
<add name="MarksDB" connectionString="Server=MYSQLSERVER\A;Database=test_d; Trusted_Connection=Yes; Application Name=MarksDB"/>
</connectionStrings>
<system.web>
<authorization>
<allow roles="Admins" />
<deny users="?" />
</authorization>
<authentication mode="Forms">
<forms name="MarksDB" />
</authentication>
<membership defaultProvider="MarksDBMembershipProvider">
<providers>
<clear/>
<add
name="MarksDBMembershipProvider"
type="System.Web.Security.SqlMembershipProvider, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
connectionStringName="MarksDB"
enablePasswordRetrieval="false"
enablePasswordReset="true"
requiresQuestionAndAnswer="true"
applicationName="MarksDBMembershipProvider"
requiresUniqueEmail="false"
passwordFormat="Hashed"
maxInvalidPasswordAttempts="5"
minRequiredPasswordLength="7"
minRequiredNonalphanumericCharacters="1"
passwordAttemptWindow="10"
passwordStrengthRegularExpression=""/>
</providers>
</membership>
<roleManager enabled="true" defaultProvider="MarksDBRoleProvider">
<providers>
<clear/>
<add
name="MarksDBRoleProvider"
type="System.Web.Security.SqlRoleProvider, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
connectionStringName="MarksDB"
applicationName="MarksDBRoleProvider"
/>
</providers>
</roleManager>
的有關章節在Visual Studio 2010中,當我去網站 - > ASP.NET配置,然後單擊添加用戶的安全選項卡上,我得到這個錯誤:
An error was encountered. Please return to the previous page and try again.
The following message may help in diagnosing the problem: The connection name 'MarksDB' was not found in the applications configuration or the connection string is empty. at System.Web.Util.SecUtility.GetConnectionString(NameValueCollection config) at System.Web.Security.SqlMembershipProvider.Initialize(String name, NameValueCollection config) at System.Web.Configuration.ProvidersHelper.InstantiateProvider(ProviderSettings providerSettings, Type providerType)
我不知道如何解決這個問題。有任何想法嗎?
我從我的web.config中的成員資格提供程序和角色提供程序中刪除了applicationName屬性,但當我單擊創建用戶時仍然出現相同的錯誤。 – 2010-11-26 09:58:18