Mic*_*per 11 asp.net mvc-mini-profiler web
我怎样才能在asp.net网站上使用miniprofiler(不适用于MVC)?MVC有很多资源,但我找不到任何网站.
感谢Alex.现在它适用于asp.net网站.但我无法理解它显示的是什么.我没有在方法中编写任何代码.见下图.
代码如下,我运行了profiler.
protected void Page_Load(object sender, EventArgs e)
{
using (MiniProfiler.Current.Step("test"))
{
Page.Title = "12345";
}
}
Run Code Online (Sandbox Code Playgroud)
Ale*_*lex 26
PM> Install-Package MiniProfiler
在你的global.asax:
using StackExchange.Profiling;
...
protected void Application_BeginRequest()
{
if (Request.IsLocal)
{
MiniProfiler.Start();
}
}
protected void Application_EndRequest()
{
MiniProfiler.Stop();
}
Run Code Online (Sandbox Code Playgroud)
然后在您的母版页中的某个位置:
<%= StackExchange.Profiling.MiniProfiler.RenderIncludes() %>
Run Code Online (Sandbox Code Playgroud)
这应该足以启动.