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錯誤。