我的服务堆栈 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();
}