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

Mar*_*lon 4 elmah iis-express

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

还有其他人遇到过这个问题吗?

Ati*_*ziz 5

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

<!-- 
    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>
Run Code Online (Sandbox Code Playgroud)