ELMAH不会记录 [英] ELMAH is not logging

查看:176
本文介绍了ELMAH不会记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在使用自己的计算机上ELMAH并能正常工作。我也部署了它的Win2008 IIS7和运行本地主机的网站除外力而且记录。但是,当我尝试浏览网站的其它机器上(用其他机器从网络浏览的网站)ELMAH不会记录..我'已经检查的App_Data XML和无创建。我已经给上的文件夹的网络服务persmission。

那么,问题是在浏览本地主机ELMAH日志的网站时,另一台计算机上浏览时,它没有记录。

下面是我的web.config文件。

 <结构>
< configSections>
    < sectionGroup NAME =System.Web.Extensions程序TYPE =System.Web.Configuration.SystemWebExtensionsSectionGroup,System.Web.Extensions程序,版本= 3.5.0.0,文化=中性公钥= 31BF3856AD364E35>
        < sectionGroup NAME =脚本TYPE =System.Web.Configuration.ScriptingSectionGroup,System.Web.Extensions程序,版本= 3.5.0.0,文化=中性公钥= 31BF3856AD364E35>
            <节名称=scriptResourceHandlerTYPE =System.Web.Configuration.ScriptingScriptResourceHandlerSection,System.Web.Extensions程序,版本= 3.5.0.0,文化=中性公钥= 31BF3856AD364E35requirePermission =假allowDefinition的=MachineToApplication/ >
            < sectionGroup名称=Web服务类型=System.Web.Configuration.ScriptingWebServicesSectionGroup,System.Web.Extensions程序,版本= 3.5.0.0,文化=中性公钥= 31BF3856AD364E35>
                <节名称=jsonSerializationTYPE =System.Web.Configuration.ScriptingJsonSerializationSection,System.Web.Extensions程序,版本= 3.5.0.0,文化=中性公钥= 31BF3856AD364E35requirePermission =假allowDefinition的=无处不在/ >
                <节名称=profileServiceTYPE =System.Web.Configuration.ScriptingProfileServiceSection,System.Web.Extensions程序,版本= 3.5.0.0,文化=中性公钥= 31BF3856AD364E35requirePermission =假allowDefinition的=MachineToApplication/ >
                <节名称=的AuthenticationServiceTYPE =System.Web.Configuration.ScriptingAuthenticationServiceSection,System.Web.Extensions程序,版本= 3.5.0.0,文化=中性公钥= 31BF3856AD364E35requirePermission =假allowDefinition的=MachineToApplication/ >
                <节名称=roleServiceTYPE =System.Web.Configuration.ScriptingRoleServiceSection,System.Web.Extensions程序,版本= 3.5.0.0,文化=中性公钥= 31BF3856AD364E35requirePermission =假allowDefinition的=MachineToApplication/ >
            < / sectionGroup>
        < / sectionGroup>
    < / sectionGroup>
    < sectionGroup NAME =ELMAH>
      <节名称=安全requirePermission =假TYPE =Elmah.SecuritySectionHandler,ELMAH/>
      <节名称=错误日志requirePermission =假TYPE =Elmah.ErrorLogSectionHandler,ELMAH/>
      <节名称=errorMailrequirePermission =假TYPE =Elmah.ErrorMailSectionHandler,ELMAH/>
      <节名称=errorFilterrequirePermission =假TYPE =Elmah.ErrorFilterSectionHandler,ELMAH/>
    < / sectionGroup>
< / configSections>


    
    

-------------------------------切相关的其他非

 <&HttpHandlers的GT;
        <清除动词=*路径=* ASMX。/>
        <添加动词=*路径=*。ASMX验证=假TYPE =System.Web.Script.Services.ScriptHandlerFactory,System.Web.Extensions程序,版本= 3.5.0.0,文化=中性公钥= 31BF3856AD364E35/>
        <添加动词=*路径=* _ AppService.axd验证=假TYPE =System.Web.Script.Services.ScriptHandlerFactory,System.Web.Extensions程序,版本= 3.5.0.0,文化=中立,公钥= 31BF3856AD364E35/>
        <添加动词=GET,HEAD路径=的ScriptResource.axdTYPE =System.Web.Handlers.ScriptResourceHandler,System.Web.Extensions程序,版本= 3.5.0.0,文化=中性公钥= 31BF3856AD364E35验证= 假/>
        <* MVC添加动词=*路径=验证=假TYPE =System.Web.Mvc.MvcHttpHandler,System.Web.Mvc,版本= 1.0.0.0,文化=中性公钥= 31BF3856AD364E35 />
        <添加动词=POST,GET,HEADNAME =ELMAH路径=elmah.axdTYPE =Elmah.ErrorLogPageFactory,ELMAH/>
    < / HttpHandlers的>
    <&的HttpModules GT;
        <添加名称=ScriptModuleTYPE =System.Web.Handlers.ScriptModule,System.Web.Extensions程序,版本= 3.5.0.0,文化=中性公钥= 31BF3856AD364E35/>
        <添加名称=UrlRoutingModuleTYPE =System.Web.Routing.UrlRoutingModule,System.Web.Routing,版本= 3.5.0.0,文化=中性公钥= 31BF3856AD364E35/>
        <添加名称=错误日志TYPE =Elmah.ErrorLogModule,ELMAH/>
            <添加名称=ErrorMailTYPE =Elmah.ErrorMailModule,ELMAH/>
            <添加名称=ErrorFilterTYPE =Elmah.ErrorFilterModule,ELMAH/>
    < /&的HttpModules GT;< system.webServer>
    <验证validateIntegratedModeConfiguration =FALSE/>
    <模块runAllManagedModulesForAllRequests =真正的>
        <清除NAME =ScriptModule/>
        <清除NAME =UrlRoutingModule/>
        <添加名称=ScriptModulepreCondition =managedHandlerTYPE =System.Web.Handlers.ScriptModule,System.Web.Extensions程序,版本= 3.5.0.0,文化=中性公钥= 31BF3856AD364E35/>
        <添加名称=UrlRoutingModuleTYPE =System.Web.Routing.UrlRoutingModule,System.Web.Routing,版本= 3.5.0.0,文化=中性公钥= 31BF3856AD364E35/>
        <添加名称=错误日志TYPE =Elmah.ErrorLogModule,ELMAH/>
            <添加名称=ErrorMailTYPE =Elmah.ErrorMailModule,ELMAH/>
            <添加名称=ErrorFilterTYPE =Elmah.ErrorFilterModule,ELMAH/>
    < /模块>
    <&处理GT;
        <清除NAME =WebServiceHandlerFactory集成的/>
        <清除NAME =ScriptHandlerFactory/>
        <清除NAME =ScriptHandlerFactoryAppServices/>
        <清除NAME =ScriptResource/>
        <清除NAME =MvcHttpHandler/>
        <清除NAME =UrlRoutingHandler/>
        <添加名称=ScriptHandlerFactory动词=*PATH = preCondition =integratedModeTYPE =System.Web.Script.Services.ScriptHandlerFactory,System.Web.Extensions程序,版本= 3.5* ASMX。 .0.0,文化=中性公钥= 31BF3856AD364E35/>
        <添加名称=ScriptHandlerFactoryAppServices动词=*路径=* _ AppService.axdpreCondition =integratedModeTYPE =System.Web.Script.Services.ScriptHandlerFactory,System.Web.Extensions程序,版本= 3.5.0.0,文化=中性公钥= 31BF3856AD364E35/>
        <添加名称=ScriptResourcepreCondition =integratedMode动词=GET,HEAD路径=的ScriptResource.axdTYPE =System.Web.Handlers.ScriptResourceHandler,System.Web.Extensions程序,版本= 3.5 .0.0,文化=中性公钥= 31BF3856AD364E35/>
        <添加名称=MvcHttpHandlerpreCondition =integratedMode动词=*路径= TYPE =System.Web.Mvc.MvcHttpHandler,System.Web.Mvc,版本= 1.0.0.0* MVC。文化=中性公钥= 31BF3856AD364E35/>
        <添加名称=UrlRoutingHandlerpreCondition =integratedMode动词=*路径=UrlRouting.axdTYPE =System.Web.HttpForbiddenHandler,System.Web程序,版本= 2.0.0.0,文化=中性公钥= b03f5f7f11d50a3a/>
        <添加名称=ELMAH动词=POST,GET,HEAD路径=elmah.axdpreCondition =integratedModeTYPE =Elmah.ErrorLogPageFactory,ELMAH/>
    < /处理器>
< /system.webServer>


解决方案

当我在过去有问题同ELMAH在生产中,它通常被一两件事情:

1)的目录欲滴在尚未创建日志文件
2)ASP.NET工作进程没有写入权限投递目录

您还没有公布实际的配置部分在这里,但我把它从你的问题,你做这样的事情:

 <&ELMAH GT;
   <错误日志类型=Elmah.XmlFileErrorLog,ELMAH日志路径=〜/ App_Data文件/>
< / ELMAH>

如果你使用的App_Data,我认为文件夹已经存在于您的部署目录中。如果没有,你需要添加它。如果它的存在,尝试给在该目录上ASPNET帐户写PRIVS,如果您还没有。

I've been using ELMAH on my development machine and it works fine. I also deployed it on Win2008 IIS7 and run the LOCALHOST website with force exception and it logs.. However, when i try browsing the website on other machine (using other machine from the network to browse the website) ELMAH is not logging.. I've check the App_Data for xml and none created. I already give Network service persmission on the folders.

So, the problem is when browsing the website in localhost ELMAH logs, when browsing it on other machine it didn't logs.

Below is my web.config file..

<configuration>
<configSections>
    <sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
        <sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
            <section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
            <sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
                <section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="Everywhere"/>
                <section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
                <section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
                <section name="roleService" type="System.Web.Configuration.ScriptingRoleServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
            </sectionGroup>
        </sectionGroup>
    </sectionGroup>
    <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>
</configSections>

------------------------------- cut other non related

<httpHandlers>
        <remove verb="*" path="*.asmx"/>
        <add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
        <add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
        <add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false"/>
        <add verb="*" path="*.mvc" validate="false" type="System.Web.Mvc.MvcHttpHandler, System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
        <add verb="POST,GET,HEAD" name="Elmah" path="elmah.axd" type="Elmah.ErrorLogPageFactory, Elmah" />
    </httpHandlers>
    <httpModules>
        <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
        <add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule, System.Web.Routing, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
        <add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah"/>
            <add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah" />
            <add name="ErrorFilter" type="Elmah.ErrorFilterModule, Elmah" />
    </httpModules>

<system.webServer>
    <validation validateIntegratedModeConfiguration="false"/>
    <modules runAllManagedModulesForAllRequests="true">
        <remove name="ScriptModule"/>
        <remove name="UrlRoutingModule"/>
        <add name="ScriptModule" preCondition="managedHandler" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
        <add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule, System.Web.Routing, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
        <add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah"/>
            <add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah" />
            <add name="ErrorFilter" type="Elmah.ErrorFilterModule, Elmah" />
    </modules>
    <handlers>
        <remove name="WebServiceHandlerFactory-Integrated"/>
        <remove name="ScriptHandlerFactory"/>
        <remove name="ScriptHandlerFactoryAppServices"/>
        <remove name="ScriptResource"/>
        <remove name="MvcHttpHandler"/>
        <remove name="UrlRoutingHandler"/>
        <add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
        <add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
        <add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
        <add name="MvcHttpHandler" preCondition="integratedMode" verb="*" path="*.mvc" type="System.Web.Mvc.MvcHttpHandler, System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
        <add name="UrlRoutingHandler" preCondition="integratedMode" verb="*" path="UrlRouting.axd" type="System.Web.HttpForbiddenHandler, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
        <add name="Elmah" verb="POST,GET,HEAD" path="elmah.axd" preCondition="integratedMode" type="Elmah.ErrorLogPageFactory, Elmah" />
    </handlers>
</system.webServer>

解决方案

When I've had issues with ELMAH in production in the past, it's typically been one of two things:

1) The directory I want to drop the log files in has not been created 2) The ASP.NET worker process does not have write permission to the drop directory

You haven't posted the actual config section here, but I take it from your question that you're doing something like this:

<elmah> 
   <errorLog type="Elmah.XmlFileErrorLog, Elmah" logPath="~/App_Data" /> 
</elmah> 

If you're using App_Data, I assume that folder already exists in your deployment directory. If not, you'll need to add it. If it's there, try giving the ASPNET account write privs on that directory, if you haven't already.

这篇关于ELMAH不会记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆