ここに示すように、ServiceStack の MiniProfiler の結果を SQL Server に記録しようとしています。
注: 上記は ServiceStack の MiniProfiler を使用していませんが、この部分に関する特定の ServiceStack ドキュメントは見つかりませんでした。
私の問題は、ServiceStack の MiniProfiler では、次のように「 SqlServerStorage 」を解決できないことです。
Profiler.Settings.Storage = new SqlServerStorage(connStr);
OrmLite の ProfiledDbConnection を使用して ServiceStack (3.9.55.0 / IIS7 がホストされている) で MiniProfiler を使用していますが、(HttpRuntimeCacheStorage を介した) デフォルトのオンページ/ライブ結果ですべて問題ありません。
以下で私がやっていることに何か問題があることがわかりますか、それとも ServiceStack でこれを実行する方法の簡単な例を提供できますか?
protected void Application_BeginRequest(object sender, EventArgs e)
{
if (Request.IsLocal)
{
var connStr = _connStr;
// *** my problem is that SqlServerStorage is not resolving ***
Profiler.Settings.Storage = new SqlServerStorage(connStr);
// *** whereas HttpRuntimeCacheStorage is resolved and works fine ***
//Profiler.Settings.Storage = new HttpRuntimeCacheStorage(new TimeSpan(0,0,10);
Profiler.Start();
}
}
更新: 統合ログの解決にはまだ成功していません。後でこれを読む人に役立つ場合は、次のように明示的に結果をログに記録できます: https://code.google.com/p/mvc-mini-profiler/issues/detail?id=36
protected void Application_EndRequest()
{
MiniProfiler miniProfiler = MiniProfiler.Current;
MiniProfiler.Stop();
if (miniProfiler != null)
{
Log.Debug(m => m("profiling result id:{0}\nresult:{1}", miniProfiler.Id,miniProfiler.Render()));
}
}