0
我正在关注this文章,使用ELMAH将错误记录到XML文件。我将elmah.dll添加到我的web应用程序的bin中,并修改了以下web配置。但是我没有在App_Data文件夹中找到任何xml文件。Elmah - Web配置配置
Web配置
<configSections>
<sectionGroup name="elmah">
<section name="errorLog" requirePermission="false" type="Elmah.ErrorLogSectionHandler, Elmah" />
</sectionGroup>
</configSections>
<elmah>
<errorLog type="Elmah.XmlFileErrorLog, Elmah" logPath="~/App_Data" />
</elmah>
<system.web>
<compilation debug="true" targetFramework="4.0"/>
<customErrors mode="On" defaultRedirect="Error.html"> </customErrors>
<httpHandlers>
<add verb="POST,GET,HEAD" path="elmah.axd" type="Elmah.ErrorLogPageFactory, Elmah" />
</httpHandlers>
<httpModules>
<add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah" />
</httpModules>
<httpRuntime/>
</system.web>
<system.webServer>
<validation validateIntegratedModeConfiguration="false"/>
</system.webServer>
</configuration>
注:validateIntegratedModeConfiguration
被加入,以避免一个ASP.NET设置已检测到不集成应用托管管道模式错误
后面的代码
protected void Page_Load(object sender, EventArgs e)
{
throw new InvalidCastException();
}
还给出了我可以使用http://localhost/Elmah.Articel.web/elmah.axd找到日志。所以我试着http://localhost:61276/elmah.axd,但它会抛出404错误。