所以,我不知道是否有其他人遇到这种情况,但如果我运行一个通过 IIS 7.5 Express 安装 ELMAH 的 asp.net 网站,ELMAH 拒绝记录甚至从数据库中读取。如果我改为通过 Cassini 运行网站,一切都很好。Elmah 就像一个魅力...
还有其他人遇到这个问题吗?
所以,我不知道是否有其他人遇到这种情况,但如果我运行一个通过 IIS 7.5 Express 安装 ELMAH 的 asp.net 网站,ELMAH 拒绝记录甚至从数据库中读取。如果我改为通过 Cassini 运行网站,一切都很好。Elmah 就像一个魅力...
还有其他人遇到这个问题吗?
根据您到目前为止所描述的内容,我能想出的唯一解释是 ELMAH 的模块和处理程序可能已在<system.web>
only 下注册,这就是 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>