Elmah不通过iis 7.5 express记录或读取错误

时间:2011-01-23 20:56:16

标签: elmah iis-express

所以,我不知道是否有其他人正在经历这个,但如果我运行通过IIS 7.5 Express安装了ELMAH的asp.net网站,ELMAH拒绝记录甚至从数据库中读取。如果我通过Cassini运行网站,一切都很好。 Elmah就像一个魅力......

是否有其他人遇到此问题?

1 个答案:

答案 0 :(得分:5)

根据您到目前为止所描述的内容,我能提出的唯一解释是ELMAH的模块和处理程序可能仅在<system.web>下注册,这就是ASP正在使用它们的原因。 NET开发服务器(Cassini)。另一方面,IIS Express期望这些模块和处理程序在<system.webServer>下注册。以下是sample web.config supplied with ELMAH 1.1

的摘录
<!-- 
    The <system.webServer> section is required for running ELMAH under Internet
    Information Services 7.0. It is not necessary for previous version of IIS.

    In general, it would be best to include it for all .NET Framework 2.0 and above
    configurations in order to have a more portable solution between various
    versions of IIS.

    IIS 5.x, IIS 6 require the modules and handlers to be declared in <system.web>
    whereas IIS 7 needs them declared here and complains if they are in fact
    declared in <system.web>. Fortunately, the
    <validation validateIntegratedModeConfiguration="false" /> entry tells IIS 7 
    not to worry about the modules and handlers declared in <system.web>.

    If you only ever want to use IIS 7, then do the following:

    1. Remove handlers and modules from <system.web>
    2. Remove the <validation validateIntegratedModeConfiguration="false" /> element
-->

<system.webServer>
    <validation validateIntegratedModeConfiguration="false" />
    <modules>
        <add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah" preCondition="managedHandler" />
        <add name="ErrorFilter" type="Elmah.ErrorFilterModule, Elmah" preCondition="managedHandler" />
        <add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah" preCondition="managedHandler" />
        <add name="ErrorTweet" type="Elmah.ErrorTweetModule, Elmah" preCondition="managedHandler" />
    </modules>
    <handlers>
        <add name="Elmah" path="elmah.axd" verb="POST,GET,HEAD" type="Elmah.ErrorLogPageFactory, Elmah" preCondition="integratedMode" />
    </handlers>
</system.webServer>
相关问题