2010-09-28 45 views
1

我的理解的工作是提高一個errorsignal應登錄我的錯誤或打自定義HandleErrorWithELMAHAttribute類(從這個example拍攝),但它既不。錯誤信號不與ASP.NET MVC

我對控制器使用HandleErrorWithElmah裝飾器。錯誤日誌記錄在控制器中處理未處理的異常(我明確調用Logexception並且未使用第二個代碼塊example中提到的條件)時起作用。但是,用於處理錯誤的錯誤信號功能讓我感到困惑。如何錯誤信號工作...它應該做的比其他記錄的東西......如果是這樣我該如何使用它登錄我處理的異常?

這是我使用的信號處理的錯誤

ErrorSignal.FromCurrentContext().Raise(new Exception("Some Handled Error")); 

及以下的web配置的我的設置片段

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


<elmah> 
<security allowRemoteAccess="yes" /> 
<errorLog type="Elmah.SqlErrorLog, Elmah" connectionStringName="Log" /> 
</elmah> 



<httpHandlers> 
    <add verb="POST,GET,HEAD" path="elmah.axd" type="Elmah.ErrorLogPageFactory, Elmah" /> 
</httpHandlers> 
<httpModules> 
    <add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah"/> 
</httpModules> 

回答

3

我使用ELMAH與.NET MVC,提高代碼Elmah的例外在我的程序上是有效的。我在這裏可以抓着救命稻草,但是從第四評論上ELMAH網站看不起this page有包含在不在你上面​​的例子中的Web.config幾行。

這可能是因爲你只是沒有包括在片段中的臺詞,但我想我會扔在那裏反正

+0

感謝菲爾...這解決了這個問題。看起來我們需要這些標籤,當我部署到我正在使用的IIS7。 ELMAH的信號無聲無息地讓問題變得更加神祕。在這個更詳細的解釋在這裏http://stackoverflow.com/questions/933554/elmah-not-working-with-asp-net-site#answer-1175023發現 – Mulki 2010-09-29 07:07:01