2010-07-07 115 views
2

我一直在我的開發機器上使用ELMAH,它工作正常。我也部署它在Win2008 IIS7和運行LOCALHOST網站強制例外,它記錄..但是,當我嘗試瀏覽其他機器上的網站(使用其他機器從網絡瀏覽網站)ELMAH不記錄..我已經檢查了App_Data的XML和沒有創建。我已經在這些文件夾上提供網絡服務許可。ELMAH不記錄

所以,問題是當瀏覽本地主機ELMAH日誌中的網站時,在其他機器上瀏覽它沒有記錄。

下面是我的web.config文件..

<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> 

----------------------- --------切相關

<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> 

回答

10

其他非當我在生產過去有問題同ELMAH,它通常被兩件事情之一:

1)我想刪除在尚未創建日誌文件的目錄 2)ASP.NET工作進程沒有

您還沒有公佈實際的配置部分寫權限投遞目錄在這裏,但我把它從你的問題,你正在做這樣的事情:

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

如果您使用的App_Data,我認爲文件夾已經存在於您的部署目錄。如果沒有,你需要添加它。如果它在那裏,請嘗試在該目錄上給予ASPNET帳戶寫入權限(如果尚未存在)。

+1

是的,我已經在我的配置中,這就是爲什麼Elmah正確記錄本地主機。當我說本地主機我的意思是不在開發機器,但在生產中,當我試圖瀏覽網站作爲locahost在服務器的瀏覽器時,elmah記錄生產異常。但奇怪的是,當我嘗試在其他機器的瀏覽器上瀏覽網站網址時,它並未記錄。總之,我已經在服務器上託管項目,然後我瀏覽客戶端機器上的URL和友好的錯誤顯示,但elmah沒有登錄。但在服務器上,當我瀏覽locahost elmah記錄它。 – 2010-07-07 15:52:07

+0

順便說一句,我會嘗試ASPNET帳戶。 BEC。我只給網絡服務特權,看看事情是否奏效。謝謝。 – 2010-07-07 15:53:58

+0

如果elmah在登錄到生產環境中進行瀏覽時記錄日誌,但沒有在外部請求進入方框時記錄,則聽起來可能是ASPNET。讓我知道這是否有效。 – 2010-07-07 16:30:33