0
我剛剛在我的網站上設置了健康監視,以便將錯誤記錄到數據庫並向我發送電子郵件。但是,記錄的錯誤不包含完整的堆棧跟蹤,並且行號顯示導致錯誤的代碼行 - 它只列出引發錯誤的方法,而不是實際導致問題的內部行號。這裏是從電子郵件中的示例:在ASP.NET Health Monitoring中記錄完整堆棧跟蹤(包括行號)
** Events **
---------------
Event code: 3005
Event message: An unhandled exception has occurred.
Event time: 11/6/2015 10:38:24 AM
Event time (UTC): 11/6/2015 10:38:24 AM
Event ID: xxxx Event sequence: 6 Event occurrence: 1 Event detail code: 0
Process information:
Process ID: 1724
Process name: w3wp.exe
Account name: IIS APPPOOL\xxxxx
Exception information:
Exception type: System.Exception
Exception message: Exception of type 'System.Exception' was thrown.
Request information:
Request URL: xxxxxx
Request path: /xxxx.aspx
User host address: xxxx
User: xxxx
Is authenticated: True
Authentication Type: Forms
Thread account name: IIS APPPOOL\xxxx
Thread information:
Thread ID: 26
Thread account name: IIS APPPOOL\xxxx
Is impersonating: False
Stack trace: at TestPage.Page_Load(Object sender, EventArgs e)
at System.Web.UI.Control.OnLoad(EventArgs e)
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
你可以從底部的主題信息部分中看到,該消息只是到目前爲止,以點說Page_Load中造成的錯誤,但並不表示這樣做的行號。這些信息是否可以使用健康監測進行發送
編輯:我的web.config部分,如下所示:
<!-- Health Monitoring -->
<healthMonitoring enabled="true">
<eventMappings>
<clear/>
<add name="All Errors" type="System.Web.Management.WebBaseErrorEvent" startEventCode="0" endEventCode="2147483647"/>
</eventMappings>
<providers>
<clear/>
<add type="System.Web.Management.SimpleMailWebEventProvider"
name="EmailWebEventProvider" buffer="false"
from="xxx" to="xxx"
subjectPrefix="xxxx Website Runtime Error: " />
<add connectionStringName="LocalSqlServer" maxEventDetailsLength="1073741823"
buffer="false" name="SqlWebEventProvider"
type="System.Web.Management.SqlWebEventProvider" />
</providers>
<rules>
<clear/>
<add name="All Errors To Database" eventName="All Errors" provider="SqlWebEventProvider"
profile="Default" minInstances="1" maxLimit="Infinite" minInterval="00:00:00" />
<add name="All Errors To E-Mail" eventName="All Errors" provider="EmailWebEventProvider"
profile="Default" minInstances="1" maxLimit="Infinite" minInterval="00:00:00" />
</rules>
</healthMonitoring>
你有沒有嘗試過有關它的任何解決方案?恕我直言,有用的http://mvolo.com/asp-net-health-monitoring-8-years-later反映*健康監測*,你是對的沒有用的回答這個問題 – Kiquenet