Is it possible to use ServiceStack Mini Profiler in self-hosted console application? If it is, where should I put profiler enable/disable code? In ASP.NET hosted ServiceStack it's usually in Application_BeginRequest and Application_EndRequest methods.
Using ServiceStack Mini Profiler in self-hosted console application
Asked Answered
when running ServiceStack in self-hosting mode, HttpContext.Current is always null. It seems that MiniProfiler relies on it. –
Acroter
You could do it like this:
namespace ConsoleApplication1 {
class Program {
static void Main(string[] args) {
// enable here
// your code
// disable here
}
}
}
or in the constructor and destructor like this:
namespace ConsoleApplication1 {
class Program {
Program() {
// enable here
}
~Program(){
// disable here
}
static void Main(string[] args) {
// your code
}
}
}
can u put, more detail implementation, try using profiler.start on ctor and profiler.stop on dispose but no result out (js dialog as in web) –
Emissive
public abstract class MyHostBase : AppSelfHostBase
{
this.GlobalRequestFilters.Add(OnBeginOfRequest);
this.GlobalResponseFilters.Add(OnEnfOfRequest);
}
© 2022 - 2024 — McMap. All rights reserved.