0
我想從ASP.NET MVC應用程序輸出到Trace.axd。我在OnActionExecuting(),OnActionExecuted(),OnResultExecuting()和OnResultExecuted()中有跟蹤,並且除了OnResultExecuted()之外,它們都輸出到Trace.axd。在MVC中的OnResultExecuted()跟蹤不工作
爲了完整性這裏是我的代碼(完全一樣的OnActionX()):
protected override void OnResultExecuting(ResultExecutingContext filterContext)
{
resultStartTime = DateTime.Now;
filterContext.HttpContext.Trace.Warn("OnResultExecuting: " + actionStartTime);
base.OnResultExecuting(filterContext);
}
protected override void OnResultExecuted(ResultExecutedContext filterContext)
{
DateTime resultEndTime = DateTime.Now;
filterContext.HttpContext.Trace.Warn("OnResultExecuted: " + resultEndTime);
filterContext.HttpContext.Trace.Warn("OnResultExecuted - OnResultExecuting: " + (resultEndTime - resultStartTime).TotalSeconds);
base.OnResultExecuted(filterContext);
}
我使用ELMAH但我有禁用它,我仍然得到這個問題。
也許這是MVC中的錯誤? – stusherwin 2010-06-09 11:18:42