我打开了健康监控,但我试图理解以下错误:
异常(exception):
Exception information:
Exception type: System.InvalidCastException
Exception message: Specified cast is not valid.
Thread information:
Thread ID: 5
Thread account name: NT AUTHORITY\NETWORK SERVICE
Is impersonating: False
Stack trace: at _Default.Repeater1_ItemDataBound(Object sender, RepeaterItemEventArgs e)
at System.Web.UI.WebControls.Repeater.CreateControlHierarchy(Boolean useDataSource)
at System.Web.UI.WebControls.Repeater.OnDataBinding(EventArgs e)
at _Default.up1_Load()
at _Default.Timer1_Tick(Object sender, EventArgs e)
at System.Web.UI.Timer.OnTick(EventArgs e)
at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
我只是想弄清楚问题究竟发生在哪里以及它是什么 - 它发生在 Repeater1_ItemDataBound 子例程中,还是发生在 Timer1_Tick 子例程中?错误发生在跟踪的顶部还是底部之前发生的最后一件事是什么?
非常感谢任何帮助
谢谢
最佳答案
wikipedia entry堆栈跟踪应该有所帮助,但本质上堆栈跟踪是线程/程序在给定时间(通常在异常期间)所在的方法/函数的列表。
堆栈跟踪中的最上面一行是线程/程序“当前所在”(即当前正在执行)的方法/函数,下一行是调用上面一行中给出的方法的方法/函数,等等。 ..
例如,如果我有以下代码(在 C# 中):
void Timer1_Tick()
{
SomeMethod();
}
void SomeMethod()
{
AnotherMethod();
}
void AnotherMethod()
{
// Suppose I have a exception / stack trace taken at this point
}
我可能会得到以下堆栈跟踪:
AnotherMethod()
SomeMethod()
Timer1_Tick()
简而言之 - 您的错误可能出在方法
Repeater1_ItemDataBound
中的某个地方,因为这是堆栈跟踪中的“最外层”/最顶层方法。
关于asp.net - 帮助理解此堆栈跟踪,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2108687/