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