所以我一直都在使用elmeh。
[我有一个最近转换为MVC3 .net4和vs2010的应用程序,它是在服务器2008机壳上开发的(与我在XP机壳上开发的其他应用程序相反)。
我正常设置了elmah,但不起作用...
我已经有对ELMAH.dll的引用,它在我的CommonDLLs文件夹中。
我添加节组
<sectionGroup name="elmah">
<section name="security" requirePermission="false" type="Elmah.SecuritySectionHandler, Elmah" />
<section name="errorLog" requirePermission="false" type="Elmah.ErrorLogSectionHandler, Elmah" />
<section name="errorMail" requirePermission="false" type="Elmah.ErrorMailSectionHandler, Elmah" />
<section name="errorFilter" requirePermission="false" type="Elmah.ErrorFilterSectionHandler, Elmah" />
</sectionGroup>
我添加了部分
<elmah>
<security allowRemoteAccess="1" />
<errorLog type="Elmah.XmlFileErrorLog, Elmah" logPath="~/ELMAH" />
<!--<errorLog type="Elmah.XmlFileErrorLog, Elmah" logPath="~/App_Data" />-->
<errorMail from="[email protected]" to="[email protected]" subject="Application: StudentPortal3G, Environment:Dev, ServerBoxName: Dev" async="true" />
</elmah>
我添加了模块和处理程序
<httpHandlers>
<add verb="*" path="*.pdfx" type="JCDCHelper.Web.UI.RunAsASPXHandler, JCDCHelper.Web" />
<add verb="*" path="*.mvc" validate="false" type="System.Web.Mvc.MvcHttpHandler, System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
<add verb="POST,GET,HEAD" path="elmah.axd" type="Elmah.ErrorLogPageFactory, Elmah" />
</httpHandlers>
<httpModules>
<add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah" />
<add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah" />
</httpModules>
我添加了用于电子邮件支持的SMTP部分
<system.net>
<!--Required for Elmah Mail Processing-->
<mailSettings>
<smtp deliveryMethod="Network">
<network host="10.10.10.10" port="25" defaultCredentials="true" />
</smtp>
</mailSettings>
</system.net>
我进入“〜\ ELMAH”文件夹,选择我的机器,并赋予网络服务帐户对该文件夹的完全控制权(以防万一,每个人都一样)
我设置了elmah.axd的路由,使其作为网页通过。
routes.IgnoreRoute("elmah.axd");
我添加了位置标记,因此无需登录就可以访问elmah.axd
<location path="elmah.axd">
<system.web>
<authorization>
<!--<deny users="?" /> in prod and qa change to this, otherwise anyoen can look at the logs - EWB-->
<allow users="*" />
</authorization>
</system.web>
</location>
但是我什么也没收到,没有Elmah电子邮件,没有XML登录到ELMAH文件夹,当我转到elmah.axd时没有404
我想念的是什么?没有任何帮助。
谢谢,
Cal-
在IIS7下,您需要在web.config的system.webserver节点下添加httpHandlers和httpModulea。
此线程应提供帮助:http://groups.google.com/group/elmah/browse_thread/thread/4bbef2f26e0c5fd1
不是您不发布超链接作为答案的规则吗?
Quote:“
这里是选项...
1],如果要使web.config在Visual Studio / Cassini,IIS5x,IIS6和IIS7中工作,则需要将以下内容合并到web.config中:
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<modules>
<add name="Elmah.ErrorLog" type="Elmah.ErrorLogModule, Elmah" preCondition="managedHandler" />
</modules>
<handlers>
<add name="Elmah" path="elmah.axd" verb="POST,GET,HEAD" type="Elmah.ErrorLogPageFactory, Elmah" preCondition="integratedMode" />
</handlers>
</system.webServer>
2),如果您只想在IIS7中运行(并且永远不会在Visual Studio / Cassini,IIS5x,IIS6中运行),那么您可以这样做:
a)删除httpModules和httpHandlers部分中对elmah的所有引用
b)将此合并到web.config
<system.webServer>
<modules>
<add name="Elmah.ErrorLog" type="Elmah.ErrorLogModule, Elmah" preCondition="managedHandler" />
</modules>
<handlers>
<add name="Elmah" path="elmah.axd" verb="POST,GET,HEAD" type="Elmah.ErrorLogPageFactory, Elmah" preCondition="integratedMode" />
</handlers>
</system.webServer>
“