サービススタックWebサービスにMVCプロファイラーがあり、リクエストがNlogに記録されているのがわかります。
ただし、PostgreSQLデータベースのプロファイルを作成しようとすると、ログが生成されません。
私は自分のglobal.asax.csにあります:
var dbConnectionFactory = new OrmLiteConnectionFactory(
"Server=127.0.0.1;Port=5432;Database=mydatabase;User
Id=id;Password=password;")
{
ConnectionFilter = x => new
ProfiledDbConnection(x, Profiler.Current)
};
builder.RegisterInstance(dbConnectionFactory).
ExternallyOwned().As<IDbConnectionFactory>();
var autofacContainer = builder.Build();
//set Autofac as default Dependency Resolver for application
DependencyResolver.SetResolver(new
AutofacDependencyResolver(autofacContainer));
と
protected void Application_BeginRequest()
{
if (Request.IsLocal)
{
Profiler.Start();
}
}
protected void Application_EndRequest(object src, EventArgs e)
{
if (Profiler.Current != null)
{
Logger.Debug("profiling result id:{0}\nresult:{1}", Profiler.Current.Id,Profiler.Current.Render());
}
Profiler.Stop();
}