MVC-Mini-Profiler - Web窗体 - 无法找到/ mini-profiler-results

Nat*_*ate 16 asp.net profiling umbraco asp.net-profiles

我正在尝试使用MVC-mini-profiler来处理webforms.

NUGET
我已经安装了Nuget包.

PM> Install-Package MiniProfiler
Run Code Online (Sandbox Code Playgroud)

团长
我有这个在我的网站的头部.

<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script>
<%= MvcMiniProfiler.MiniProfiler.RenderIncludes() %>
Run Code Online (Sandbox Code Playgroud)

DAL
我在一个函数中使用它作为POC.这不在Global.asax中(我不知道是否需要.)

profiler = MiniProfiler.Start();

using (profiler.Step("Im doing stuff"))
{
   //do stuff here
}

MvcMiniProfiler.MiniProfiler.Stop();
Run Code Online (Sandbox Code Playgroud)

结果
<div class="profiler-results left"></div>在我的页面上呈现标记,但它是空的.

如果我查看chrome控制台,我会看到404试图找到:http://example.com/mini-profiler-results?id = 339d84a7-3898-429f-994b-64038462d59a&popup = 1

问题
我错过了让/ mini-profiler-results链接起作用的步骤吗?

回答
我标记为回答的响应让我认为它与我的配置无关(这是真的).我使用的是Umbraco 4.7.0.我不得不在web.config中的umbracoReservedUrls和umbracoReservedPaths中添加"〜/ mini-profiler-results".

Dar*_*rov 21

安装NuGet包之后,以下页面对我来说非常有用:

<%@ Page Language="C#" %>
<%@ Import Namespace="MvcMiniProfiler" %>
<%@ Import Namespace="System.Threading" %>

<script type="text/c#" runat="server">
    protected void Page_Load(object sender, EventArgs e)
    {
        MiniProfiler.Start();
        using (MiniProfiler.Current.Step("I'm doing stuff"))
        {
            Thread.Sleep(300);
        }
        MiniProfiler.Stop();
    }
</script>

<!DOCTYPE html>
<html>
<head runat="server">
    <title></title>
    <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script>
    <%= MiniProfiler.RenderIncludes() %>
</head>
<body>
    <form id="Form1" runat="server">
        <div>Hello World</div>
    </form>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)

  • 对于最新版本的快速更新,命名空间已从"MvcMiniProfiler"更改为"StackExchange.Profiling",因此只需更改第二行,这一切都很好..... (8认同)