2013-05-06 57 views
7

Có thể sử dụng ServiceStack Mini Profiler trong ứng dụng bảng điều khiển tự lưu trữ không? Nếu có, tôi nên đặt mã kích hoạt/vô hiệu hóa ở đâu? Trong ASP.NET lưu trữ ServiceStack nó thường là trong Application_BeginRequestApplication_EndRequest phương pháp.Sử dụng ServiceStack Mini Profiler trong ứng dụng giao diện điều khiển tự lưu trữ

+1

khi chạy ServiceStack ở chế độ tự lưu trữ, HttpContext.Current luôn là vô giá trị. Có vẻ như MiniProfiler dựa vào nó. – migajek

Trả lời

0

Bạn có thể làm điều đó như thế này:

namespace ConsoleApplication1 { 
    class Program { 
    static void Main(string[] args) { 
     // enable here 

     // your code 

     // disable here 
    } 
    } 
} 

hoặc trong constructor và destructor như thế này:

namespace ConsoleApplication1 { 
    class Program { 
    Program() { 
     // enable here 
    } 

    ~Program(){ 
     // disable here 
    } 

    static void Main(string[] args) { 
     // your code 
    } 
    } 
} 
+0

bạn có thể đặt, triển khai chi tiết hơn, hãy thử sử dụng profiler.start trên ctor và profiler.stop để vứt bỏ nhưng không có kết quả (hộp thoại js như trong web) –

0
public abstract class MyHostBase : AppSelfHostBase 
{ 
    this.GlobalRequestFilters.Add(OnBeginOfRequest); 
    this.GlobalResponseFilters.Add(OnEnfOfRequest); 
}