mvc-mini-profiler(http://code.google.com/p/mvc-mini-profiler/)を使い始めたばかりですが、すばらしいと思います。ただし、使用中に奇妙な動作が発生します。
IIS7.5でASP.NETWebformsサイトを実行していますが、何らかの理由でプロファイラーを有効にしてページをロードすると、aspxページの時間測定値を取得するだけでなく、ランダムcssとランダムcssの時間測定値も取得します。ページ上のjsリソース。
aspxプロファイルは正しく機能し、SQLクエリも正しくプロファイルされます。ただし、写真が示すように、静的CSSファイルとJSファイルの結果のように見える他の結果もたくさん得られます。私の知る限り、これらはIISによって静的に提供されているため、これらに対してプロファイラーコードを呼び出すことはできません。
私のGlobal.asaxの関連部分は次のとおりです。
protected void Application_BeginRequest()
{
MiniProfiler profiler = null;
// might want to decide here (or maybe inside the action) whether you want
// to profile this request - for example, using an "IsSystemAdmin" flag against
// the user, or similar; this could also all be done in action filters, but this
// is simple and practical; just return null for most users. For our test, we'll
// profile only for local requests (seems reasonable)
profiler = MiniProfiler.Start();
using (profiler.Step("Application_BeginRequest"))
{
// you can start profiling your code immediately
}
}
protected void Application_EndRequest()
{
MvcMiniProfiler.MiniProfiler.Stop();
}
protected void Application_AuthenticateRequest(object sender, EventArgs e)
{
if (User == null || !User.Identity.IsAuthenticated)
{
MvcMiniProfiler.MiniProfiler.Stop(true);
}
}
この動作は予想されますか?