配置ELMAH:无法识别的配置节错误 [英] Configuring ELMAH: Unrecognized config section error

查看:239
本文介绍了配置ELMAH:无法识别的配置节错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

设置:


  • Windows XP中

  • 的.NET Framework 3.5 SP1

  • ASP .NET MVC 1版

我一直在尝试通过 HTTP按照说明设置ELMAH:// code.google.com / p / ELMAH /维基/ MVC 但我只是碰到下面的错误时,preSS F5:


说明:该请求提供服务所需的配置文件的处理过程中发生错误。请检查下面的特定错误详细信息并适当地修改配置文件。

 分析器错误信息:无法识别的配置节ELMAH /错误日志。源错误:
第30行:
第31行:LT; ELMAH>
第32行:其中,错误日志类型=Elmah.XmlFilerErrorLog,ELMAH日志路径=〜/ App_Data文件/>
第33行:LT; / ELMAH>
34号线:

和,这里的配置文件:

 <?XML版本=1.0&GT?;
<! -
    注意:作为一种替代手工编辑这个文件,你可以使用
    Web管理工具来配置应用程序的设置。使用
    该网站 - >在Visual Studio中Asp.Net配置选项。
    设置和注释的完整列表中可以找到
    machine.config.comments通常位于
    \\ WINDOWS \\ Microsoft.Net \\框架\\ V2.X \\配置
- >
<结构>
    < configSections>
        < sectionGroup NAME =ELMAH>
            <节名称=安全TYPE =Elmah.SecuritySectionHandler,ELMAH/>
            <节名称=错误日志TYPE =Elmah.ErrorLogSectionHandler,ELMAH/>
            <节名称=errorMailTYPE =Elmah.ErrorMailSectionHandler,ELMAH/>
            <节名称=errorFilterTYPE =Elmah.ErrorFilterSectionHandler,ELMAH/>
        < / sectionGroup>
        < sectionGroup NAME =System.Web.Extensions程序TYPE =System.Web.Configuration.SystemWebExtensionsSectionGroup,System.Web.Extensions程序,版本= 3.5.0.0,文化=中性公钥= 31BF3856AD364E35>
            < sectionGroup NAME =脚本TYPE =System.Web.Configuration.ScriptingSectionGroup,System.Web.Extensions程序,版本= 3.5.0.0,文化=中性公钥= 31BF3856AD364E35>
                <节名称=scriptResourceHandlerTYPE =System.Web.Configuration.ScriptingScriptResourceHandlerSection,System.Web.Extensions程序,版本= 3.5.0.0,文化=中性公钥= 31BF3856AD364E35requirePermission =假allowDefinition的=MachineToApplication/ >
                < sectionGroup名称=Web服务类型=System.Web.Configuration.ScriptingWebServicesSectionGroup,System.Web.Extensions程序,版本= 3.5.0.0,文化=中性公钥= 31BF3856AD364E35>
                    <节名称=jsonSerializationTYPE =System.Web.Configuration.ScriptingJsonSerializationSection,System.Web.Extensions程序,版本= 3.5.0.0,文化=中性公钥= 31BF3856AD364E35requirePermission =假allowDefinition的=无处不在/ >
                    <节名称=profileServiceTYPE =System.Web.Configuration.ScriptingProfileServiceSection,System.Web.Extensions程序,版本= 3.5.0.0,文化=中性公钥= 31BF3856AD364E35requirePermission =假allowDefinition的=MachineToApplication/ >
                    <节名称=的AuthenticationServiceTYPE =System.Web.Configuration.ScriptingAuthenticationServiceSection,System.Web.Extensions程序,版本= 3.5.0.0,文化=中性公钥= 31BF3856AD364E35requirePermission =假allowDefinition的=MachineToApplication/ >
                    <节名称=roleServiceTYPE =System.Web.Configuration.ScriptingRoleServiceSection,System.Web.Extensions程序,版本= 3.5.0.0,文化=中性公钥= 31BF3856AD364E35requirePermission =假allowDefinition的=MachineToApplication/ >
                < / sectionGroup>
            < / sectionGroup>
        < / sectionGroup>
    < / configSections>    <&ELMAH GT;
        <错误日志类型=Elmah.XmlFilerErrorLog,ELMAH日志路径=〜/ App_Data文件/>
    < / ELMAH>    <的appSettings />
    <&是connectionStrings GT;
        <添加名称=ApplicationServices的connectionString =数据源= \\ SQLEX $ P $干燥综合征;集成安全性= SSPI; AttachDBFilename = | DataDirectory目录| ASPNETDB.MDF;用户实例=真的providerName =System.Data.SqlClient的 />
    < /&是connectionStrings GT;
    <&的System.Web GT;
        <! -
            集编译调试=true以将调试
            符号插入到编译页。因为这
            影响性能,因此将该值设置为唯一的真
            在开发过程中。
     - >
        <编译调试=真正的>
            <&集会GT;
                <添加组件=System.Core程序,版本= 3.5.0.0,文化=中性公钥= B77A5C561934E089/>
                <添加组件=System.Web.Extensions程序,版本= 3.5.0.0,文化=中性公钥= 31BF3856AD364E35/>
                <添加组件=System.Web.Abstractions,版本= 3.5.0.0,文化=中性公钥= 31BF3856AD364E35/>
                <添加组件=System.Web.Routing,版本= 3.5.0.0,文化=中性公钥= 31BF3856AD364E35/>
                <添加组件=System.Web.Mvc,版本= 1.0.0.0,文化=中性公钥= 31BF3856AD364E35/>
                <添加组件=System.Data.DataSetExtensions,版本= 3.5.0.0,文化=中性公钥= B77A5C561934E089/>
                <添加组件=System.Xml.Linq的,版本= 3.5.0.0,文化=中性公钥= B77A5C561934E089/>
                <添加组件=System.Data.Linq程序,版本= 3.5.0.0,文化=中性公钥= B77A5C561934E089/>
            < /组件>
        < /编译>
        <! -
            在<身份验证和GT;节可以配置
            所使用的安全性的认证模式的
            ASP.NET识别传入的用户。
     - >
        <身份验证模式=表格>
            <形式loginUrl =〜/帐号/登录超时=2880/>
        < /认证>
        <会员和GT;
            <供应商>
                <清/>
                <添加名称=AspNetSqlMembershipProviderTYPE =System.Web.Security.SqlMembershipProvider,System.Web程序,版本= 2.0.0.0,文化=中性公钥= b03f5f7f11d50a3a的connectionStringName =ApplicationServicesenablePasswordRetrieval =假enablePasswordReset设置=真正的requiresQuestionAndAnswer =假requiresUniqueEmail =假了passwordFormat =散列maxInvalidPasswordAttempts =5minRequiredPasswordLength =6minRequiredNonalphanumericCharacters =0passwordAttemptWindow =10passwordStrengthRegularEx pression =的applicationName =/ />
            < /供应商>
        < /会员>
        <型材>
            <供应商>
                <清/>
                <添加名称=AspNetSqlProfileProviderTYPE =System.Web.Profile.SqlProfileProvider,System.Web程序,版本= 2.0.0.0,文化=中性公钥= b03f5f7f11d50a3a的connectionStringName =ApplicationServices的applicationName =//>
            < /供应商>
        < / profile文件>
        < roleManager启用=false的>
            <供应商>
                <清/>
                <添加的connectionStringName =ApplicationServices的applicationName =/NAME =AspNetSqlRoleProviderTYPE =System.Web.Security.SqlRoleProvider,System.Web程序,版本= 2.0.0.0,文化=中性公钥= b03f5f7f11d50a3a/>
                <添加的applicationName =/NAME =AspNetWindowsTokenRoleProviderTYPE =System.Web.Security.WindowsTokenRoleProvider,System.Web程序,版本= 2.0.0.0,文化=中性公钥= b03f5f7f11d50a3a/>
            < /供应商>
        < / roleManager>
        <! -
            在<&的customErrors GT;节可以配置
            的什么,如果/当发生未处理的错误做
            一个请求的执行过程中。特别,
            它允许开发人员配置HTML错误页
            要显示代替错误堆栈跟踪。        <的customErrors模式=仅限远程的defaultRedirect =GenericErrorPage.htm>
            <错误状态code =403重定向=NoAccess.htm/>
            <错误状态code =404重定向=FileNotFound.htm/>
        < /&的customErrors GT;
     - >
        <网页和GT;
            <控制与GT;
                <添加标签preFIX =ASP的命名空间=System.Web.UI程序组件=System.Web.Extensions程序,版本= 3.5.0.0,文化=中性公钥= 31BF3856AD364E35/>
                <添加标签preFIX =ASP的命名空间=System.Web.UI.WebControls集结号=System.Web.Extensions程序,版本= 3.5.0.0,文化=中性公钥= 31BF3856AD364E35/>
            < /控制>
            <&命名空间GT;
                <添加命名空间=System.Web.Mvc/>
                <添加命名空间=System.Web.Mvc.Ajax/>
                <添加命名空间=System.Web.Mvc.Html/>
                <添加命名空间=System.Web.Routing/>
                <添加命名空间=System.Linq的/>
                <添加命名空间=System.Collections.Generic/>
            < /命名空间>
        < /页>
        <&HttpHandlers的GT;
            <清除动词=*路径=* ASMX。/>
            <添加动词=POST,GET,HEAD路径=elmah.axdTYPE =Elmah.ErrorLogPageFactory,ELMAH/>
            <添加动词=*路径=*。ASMX验证=假TYPE =System.Web.Script.Services.ScriptHandlerFactory,System.Web.Extensions程序,版本= 3.5.0.0,文化=中性公钥= 31BF3856AD364E35/>
            <添加动词=*路径=* _ AppService.axd验证=假TYPE =System.Web.Script.Services.ScriptHandlerFactory,System.Web.Extensions程序,版本= 3.5.0.0,文化=中立,公钥= 31BF3856AD364E35/>
            <添加动词=GET,HEAD路径=的ScriptResource.axdTYPE =System.Web.Handlers.ScriptResourceHandler,System.Web.Extensions程序,版本= 3.5.0.0,文化=中性公钥= 31BF3856AD364E35验证= 假/>
            <* MVC添加动词=*路径=验证=假TYPE =System.Web.Mvc.MvcHttpHandler,System.Web.Mvc,版本= 1.0.0.0,文化=中性公钥= 31BF3856AD364E35 />
        < / HttpHandlers的>
        <&的HttpModules GT;
            <添加名称=错误日志TYPE =Elmah.ErrorLogModule,ELMAH/>
            <添加名称=ScriptModuleTYPE =System.Web.Handlers.ScriptModule,System.Web.Extensions程序,版本= 3.5.0.0,文化=中性公钥= 31BF3856AD364E35/>
            <添加名称=UrlRoutingModuleTYPE =System.Web.Routing.UrlRoutingModule,System.Web.Routing,版本= 3.5.0.0,文化=中性公钥= 31BF3856AD364E35/>
        < /&的HttpModules GT;
    < /system.web>
    <系统codeDOM>
        <编译器>
            <编译语言=C#; CS; CSHARPCS延长= warningLevel =4TYPE =Microsoft.CSharp.CSharp codeProvider,系统,版本= 2.0.0.0,文化=中性公钥= b77a5c561934e089>
                < providerOption NAME =CompilerVersionVALUE =V3.5/>
                < providerOption NAME =warnaserror将值=FALSE/>
            < /编译器>
            <编译语言=VB,VBS,VisualBasic中; VBSCRIPTVB延长= warningLevel =4TYPE =Microsoft.VisualBasic.VB codeProvider,系统,版本= 2.0.0.0,文化=中立,公钥= b77a5c561934e089>
                < providerOption NAME =CompilerVersionVALUE =V3.5/>
                < providerOption NAME =OptionInferVALUE =真/>
                < providerOption NAME =warnaserror将值=FALSE/>
            < /编译器>
        < /编译器>
    < /system.$c$cdom>
    < System.Web.Extensions程序/>    < system.webServer>
        <验证validateIntegratedModeConfiguration =FALSE/>
        <模块runAllManagedModulesForAllRequests =真正的>
            <清除NAME =ScriptModule/>
            <清除NAME =UrlRoutingModule/>
            <添加名称=ScriptModulepreCondition =managedHandlerTYPE =System.Web.Handlers.ScriptModule,System.Web.Extensions程序,版本= 3.5.0.0,文化=中性公钥= 31BF3856AD364E35/>
            <添加名称=UrlRoutingModuleTYPE =System.Web.Routing.UrlRoutingModule,System.Web.Routing,版本= 3.5.0.0,文化=中性公钥= 31BF3856AD364E35/>
        < /模块>
        <&处理GT;
            <清除NAME =WebServiceHandlerFactory集成的/>
            <清除NAME =ScriptHandlerFactory/>
            <清除NAME =ScriptHandlerFactoryAppServices/>
            <清除NAME =ScriptResource/>
            <清除NAME =MvcHttpHandler/>
            <清除NAME =UrlRoutingHandler/>
            <添加名称=ScriptHandlerFactory动词=*PATH = preCondition =integratedModeTYPE =System.Web.Script.Services.ScriptHandlerFactory,System.Web.Extensions程序,版本= 3.5* ASMX。 .0.0,文化=中性公钥= 31BF3856AD364E35/>
            <添加名称=ScriptHandlerFactoryAppServices动词=*路径=* _ AppService.axdpreCondition =integratedModeTYPE =System.Web.Script.Services.ScriptHandlerFactory,System.Web.Extensions程序,版本= 3.5.0.0,文化=中性公钥= 31BF3856AD364E35/>
            <添加名称=ScriptResourcepreCondition =integratedMode动词=GET,HEAD路径=的ScriptResource.axdTYPE =System.Web.Handlers.ScriptResourceHandler,System.Web.Extensions程序,版本= 3.5 .0.0,文化=中性公钥= 31BF3856AD364E35/>
            <添加名称=MvcHttpHandlerpreCondition =integratedMode动词=*路径= TYPE =System.Web.Mvc.MvcHttpHandler,System.Web.Mvc,版本= 1.0.0.0* MVC。文化=中性公钥= 31BF3856AD364E35/>
            <添加名称=UrlRoutingHandlerpreCondition =integratedMode动词=*路径=UrlRouting.axdTYPE =System.Web.HttpForbiddenHandler,System.Web程序,版本= 2.0.0.0,文化=中性公钥= b03f5f7f11d50a3a/>
        < /处理器>
    < /system.webServer>
< /结构>

修改

解决

以下块应该去后< /system.webServer> 和前< /结构>

 <&ELMAH GT;
        <错误日志类型=Elmah.XmlFileErrorLog,ELMAH日志路径=〜/ App_Data文件/>
    < / ELMAH>


解决方案

XML是大小写敏感的:

 <节名称=错误日志TYPE =Elmah.ErrorLogSectionHandler,ELMAH/>

VS

 <&ELMAH GT;
  <错误日志类型=Elmah.XmlFilerErrorLog,ELMAH日志路径=〜/ App_Data文件/>
< / ELMAH>

重命名为错误日志错误日志元素,这将(应该)的工作。

Setup:

  • Windows XP
  • .NET Framework 3.5 SP1
  • ASP .NET MVC Version 1

I've been trying to set up ELMAH by following the instructions at http://code.google.com/p/elmah/wiki/MVC but I just get the following error when press F5:

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: Unrecognized configuration section elmah/errorlog.

Source Error: 


Line 30: 
Line 31:     <elmah>
Line 32:         <errorlog type="Elmah.XmlFilerErrorLog, Elmah" logPath="~/App_Data" />
Line 33:     </elmah>
Line 34:

And, here's the configuration file:

<?xml version="1.0"?>
<!-- 
    Note: As an alternative to hand editing this file you can use the 
    web admin tool to configure settings for your application. Use
    the Website->Asp.Net Configuration option in Visual Studio.
    A full list of settings and comments can be found in 
    machine.config.comments usually located in 
    \Windows\Microsoft.Net\Framework\v2.x\Config 
-->
<configuration>
    <configSections>
        <sectionGroup name="elmah">
            <section name="security" type="Elmah.SecuritySectionHandler, Elmah"/>
            <section name="errorLog" type="Elmah.ErrorLogSectionHandler, Elmah"/>
            <section name="errorMail" type="Elmah.ErrorMailSectionHandler, Elmah"/>
            <section name="errorFilter" type="Elmah.ErrorFilterSectionHandler, Elmah"/>
        </sectionGroup>
        <sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
            <sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
                <section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
                <sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
                    <section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="Everywhere"/>
                    <section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
                    <section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
                    <section name="roleService" type="System.Web.Configuration.ScriptingRoleServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
                </sectionGroup>
            </sectionGroup>
        </sectionGroup>
    </configSections>

    <elmah>
        <errorlog type="Elmah.XmlFilerErrorLog, Elmah" logPath="~/App_Data" />
    </elmah>

    <appSettings/>
    <connectionStrings>
        <add name="ApplicationServices" connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true" providerName="System.Data.SqlClient"/>
    </connectionStrings>
    <system.web>
        <!-- 
            Set compilation debug="true" to insert debugging 
            symbols into the compiled page. Because this 
            affects performance, set this value to true only 
            during development.
    -->
        <compilation debug="true">
            <assemblies>
                <add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
                <add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
                <add assembly="System.Web.Abstractions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
                <add assembly="System.Web.Routing, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
                <add assembly="System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
                <add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
                <add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
                <add assembly="System.Data.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
            </assemblies>
        </compilation>
        <!--
            The <authentication> section enables configuration 
            of the security authentication mode used by 
            ASP.NET to identify an incoming user. 
    -->
        <authentication mode="Forms">
            <forms loginUrl="~/Account/LogOn" timeout="2880"/>
        </authentication>
        <membership>
            <providers>
                <clear/>
                <add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" connectionStringName="ApplicationServices" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" passwordFormat="Hashed" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" passwordStrengthRegularExpression="" applicationName="/"/>
            </providers>
        </membership>
        <profile>
            <providers>
                <clear/>
                <add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" connectionStringName="ApplicationServices" applicationName="/"/>
            </providers>
        </profile>
        <roleManager enabled="false">
            <providers>
                <clear/>
                <add connectionStringName="ApplicationServices" applicationName="/" name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
                <add applicationName="/" name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
            </providers>
        </roleManager>
        <!--
            The <customErrors> section enables configuration 
            of what to do if/when an unhandled error occurs 
            during the execution of a request. Specifically, 
            it enables developers to configure html error pages 
            to be displayed in place of a error stack trace.

        <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
            <error statusCode="403" redirect="NoAccess.htm" />
            <error statusCode="404" redirect="FileNotFound.htm" />
        </customErrors>
    -->
        <pages>
            <controls>
                <add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
                <add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
            </controls>
            <namespaces>
                <add namespace="System.Web.Mvc"/>
                <add namespace="System.Web.Mvc.Ajax"/>
                <add namespace="System.Web.Mvc.Html"/>
                <add namespace="System.Web.Routing"/>
                <add namespace="System.Linq"/>
                <add namespace="System.Collections.Generic"/>
            </namespaces>
        </pages>
        <httpHandlers>
            <remove verb="*" path="*.asmx"/>
            <add verb="POST,GET,HEAD" path="elmah.axd" type="Elmah.ErrorLogPageFactory, Elmah"/>
            <add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
            <add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
            <add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false"/>
            <add verb="*" path="*.mvc" validate="false" type="System.Web.Mvc.MvcHttpHandler, System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
        </httpHandlers>
        <httpModules>
            <add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah"/>
            <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
            <add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule, System.Web.Routing, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
        </httpModules>
    </system.web>
    <system.codedom>
        <compilers>
            <compiler language="c#;cs;csharp" extension=".cs" warningLevel="4" type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
                <providerOption name="CompilerVersion" value="v3.5"/>
                <providerOption name="WarnAsError" value="false"/>
            </compiler>
            <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" warningLevel="4" type="Microsoft.VisualBasic.VBCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
                <providerOption name="CompilerVersion" value="v3.5"/>
                <providerOption name="OptionInfer" value="true"/>
                <providerOption name="WarnAsError" value="false"/>
            </compiler>
        </compilers>
    </system.codedom>
    <system.web.extensions/>

    <system.webServer>
        <validation validateIntegratedModeConfiguration="false"/>
        <modules runAllManagedModulesForAllRequests="true">
            <remove name="ScriptModule"/>
            <remove name="UrlRoutingModule"/>
            <add name="ScriptModule" preCondition="managedHandler" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
            <add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule, System.Web.Routing, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
        </modules>
        <handlers>
            <remove name="WebServiceHandlerFactory-Integrated"/>
            <remove name="ScriptHandlerFactory"/>
            <remove name="ScriptHandlerFactoryAppServices"/>
            <remove name="ScriptResource"/>
            <remove name="MvcHttpHandler"/>
            <remove name="UrlRoutingHandler"/>
            <add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
            <add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
            <add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
            <add name="MvcHttpHandler" preCondition="integratedMode" verb="*" path="*.mvc" type="System.Web.Mvc.MvcHttpHandler, System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
            <add name="UrlRoutingHandler" preCondition="integratedMode" verb="*" path="UrlRouting.axd" type="System.Web.HttpForbiddenHandler, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
        </handlers>
    </system.webServer>
</configuration>

Edit

Solved

The following block should have gone after </system.webServer> and before </configuration>

    <elmah>
        <errorLog type="Elmah.XmlFileErrorLog, Elmah" logPath="~/App_Data" />
    </elmah>

解决方案

Xml is case sensitive:

<section name="errorLog" type="Elmah.ErrorLogSectionHandler, Elmah"/>

vs

<elmah>
  <errorlog type="Elmah.XmlFilerErrorLog, Elmah" logPath="~/App_Data" />
</elmah>

Rename the errorlog element to errorLog and it will (should) work.

这篇关于配置ELMAH:无法识别的配置节错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆