2010-11-26 8 views
0

ASP.NET 4.0のメンバーシップに問題があります。私はweb.configファイルにすべてのメンバシップ設定を持ち、machine.configは使用しません。 MYSERVER \ AというリモートSQL Server 2008 R2データベースサーバーにメンバシップを格納しています。メンバーシッププロバイダのトラブル

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) 
:私はASP.NET設定]> [ウェブサイト - をに移動し、[セキュリティ]タブの[ユーザーの追加]をクリックしたときにここでは、Visual Studioの2010年には、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> 

の関連セクションだ、私はこのエラーを取得します

この問題のトラブルシューティング方法はわかりません。何か案は?

答えて

0

メンバシッププロバイダとロールマネージャの両方でapplicationName属性を使用してアプリケーションを指定する必要があります(同じデータベースを使用する別のアプリケーションがある可能性があるため)。しかし、接続文字列にApplication Nameを指定しています。

applicationNameをメンバーシッププロバイダとロールプロバイダから削除すると思います。

+0

web.configのメンバーシッププロバイダとロールプロバイダからapplicationNameプロパティを削除しましたが、Create Userをクリックしても同じエラーが表示されます。 –

+0

私は私のmachine.configを復元し、すべてが今働いています。私はそこから何も読んでいないので、奇妙です。 –