gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-04 05:04:33 26 4
gpt4 key购买 nike

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

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

最佳答案

根据您到目前为止所描述的,我能想到的唯一解释是 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>

关于Elmah 不会通过 iis 7.5 express 记录或读取错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4776443/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com