问题
I just experienced a high CPU issue on our production aserver and decided to practice debugging such situations locally to be prepared for this in the future, but when I try to debug a local MVC4 site, I dont get the same informative stack trace as the tutorial does.
Question: Does anyone know if it is possible to get a more informative stack trace?
I would expect to see HomeController.Index somewhere but the only method call I see is:
System.Web.Hosting.UnsafeIISMethods.MgdIndicateCompletion(IntPtr, System.Web.RequestNotificationStatus ByRef)
Local setup
I created a local MVC4 site, using .Net 4, running on the local IIS 8.0 (NOT iis express) to simulate the server environment. My local machine runs Windows 8.
Debug tool: Debug Diagnostics 1.2
I followed this link: http://www.iis.net/learn/troubleshoot/performance-issues/troubleshooting-high-cpu-in-an-iis-7x-application-pool
At "Figure 6 - A DebugDiag analysis report." there is a screenshot of a stacktrace with the top line containing "FastApp._default.Page_Load(System.Object, System.EventArgs).
The tutorial screenshot:
My screenshot:
My code simulating max CPU usage:
public class HomeController : Controller
{
public ActionResult Index(int seconds)
{
ViewBag.Message = "Modify this template to jump-start your ASP.NET MVC application.";
DateTime start = DateTime.Now;
while (DateTime.Now.Subtract(start) < TimeSpan.FromSeconds(seconds))
{
"".ToString();
}
return View();
}
}
Possible duplicate:
DebugDiag not showing .NET stack information under .NET 4
回答1:
Debug Diag 1.2 may not give you correct stack traces for .net framework 4.0. In fact it does not you the correct stack for .net 4.5 at all.
You should use Debug Diag 2.0 to analyze memory dumps targeted for framework 4.0 and above. You can get the tool from http://www.microsoft.com/en-us/download/details.aspx?id=40336
来源:https://stackoverflow.com/questions/17432560/debugdiag-and-mvc4-gives-no-usable-stacktrace