0

パスワードのログイン要件を緩和しようとしています。すべての属性を web.config ファイルに設定しましたが、何らかの理由で Type 属性が気に入りません。StackOverflow の web.config メンバーシップに関する他のすべての投稿と他のサイトを見てきましたが、それらはすべて、私が Type に対して行っているのとまったく同じ行を持っているようです。私の検索でも、このエラーについてはあまり見つけられないようです。なぜこのエラーが発生するのかわかりません:

Configuration Error 
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately. 

 Parser Error Message: Attribute not recognized 'writeExceptionsToEventLog'

  Source Error:  
  Line 16:         <clear />
  Line 17:         <add name="AspNetSqlMembershipProvider"  
  Line 18:              type="System.Web.Security.SqlMembershipProvider"  
  Line 19:              connectionStringName="CafeWorksConnectionString"
  Line 20:              requiresQuestionAndAnswer="false"

これが私のweb.configファイルです(機密情報を削除するために少し変更されています)

<?xml version="1.0"?>
<!--
  For more information on how to configure your ASP.NET application, please visit
  http://go.microsoft.com/fwlink/?LinkId=169433
  -->
<configuration>
  <appSettings>
    <add key="validationSettings:UnobtrusiveValidationMode" value="None"/>
  </appSettings>
  <system.web>
    <authentication mode="Forms" />
    <compilation debug="true" strict="false" explicit="true" targetFramework="4.5"/>
<httpRuntime targetFramework="4.5"/>
    <membership defaultProvider="AspNetSqlMembershipProvider" userIsOnlineTimeWindow="15">
      <providers>
        <clear />
        <add name="AspNetSqlMembershipProvider" 
             type="System.Web.Security.SqlMembershipProvider" 
             connectionStringName="CafeWorksConnectionString"
             requiresQuestionAndAnswer="false"
             enablePasswordRetrieval="false" enablePasswordReset="true"
             requiresUniqueEmail="false" passwordFormat="Hashed"
             minRequiredNonalphanumericCharacters="0" writeExceptionsToEventLog="false"
             minRequiredPasswordLength="4" passwordStrengthRegularExpression=""
             passwordAttemptWindow="10" maxInvalidPasswordAttempts="8"/>
      </providers>
    </membership>
  </system.web>
  <system.net>
    <mailSettings>
      <smtp from="Name@EmailHost.com">
        <network host="EmailHost" password="" userName="" />
      </smtp>
    </mailSettings>
  </system.net>
  <connectionStrings>
        <add name="CafeWorksConnectionString" connectionString="Data Source=DB;Initial Catalog=DBCatalog;Integrated Security=True" providerName="System.Data.SqlClient"/>
  </connectionStrings>
</configuration>

誰かがこのエラーを修正する方法を知っていれば、助けていただければ幸いです。「writeExceptionsToEventLog」がどこで発生しているのか、なぜエラーが発生しているのか、まったくわかりません。

ありがとうございました!

4

1 に答える 1

0

最後のコメントによると、レガシー メンバーシップ プロバイダーを使用しています。ストア プロシージャと日付を使用します。

Entity Framework を使用するASP.NET Universal Providersを使用してください。

新しいメンバーシップ プロバイダーへの置き換え方法

新しいプロジェクトを実行しているとします。その理由は、新しい Universal Provider が接頭辞 aspnet_ なしでテーブルを作成するためです。ただし、既存のプロジェクトで作業している場合は、カスタム テーブルとの関係が壊れます。

Scott Hanselman の記事に従い、最初に新しいテスト プロジェクトに取り組みます。

基本的には交換するだけですname="DefaultMembershipProvider" type="System.Web.Providers.DefaultMembershipProvider"

名前を置き換えるため、defaultProvider を次のように変更する必要もあります。defaultProvider="DefaultMembershipProvider"

残りは同じです。新しいユニバーサル プロバイダーはEntity Framework Code Firstを使用するため、必要なテーブルがまだ作成されていない場合は自動的に作成されます。ストア プロシージャを使用しないことに注意してください。

すばらしい点は、スキーマとストア プロシージャを作成するために aspnet_regsql.exe を実行する必要がないことです。

于 2013-08-14T15:10:44.560 に答える