微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

asp.net – MVC-Mini-Profiler – Web窗体 – 找不到/ mini-profiler-results

我试图让MVC-mini-profiler与webforms一起工作。

的NuGet
我已经安装了Nuget软件包。

PM> Install-Package MiniProfiler


我在网站的头部有这个。

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

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

profiler = MiniProfiler.Start();

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

MvcMiniProfiler.MiniProfiler.Stop();

结果
它呈现< div class =“profiler-results left”>< / div>标签在我的页面,但它是空的。

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


我错过了一个让/ mini-profiler-results链接工作的一步吗?

回答
标记为答案的答复使我认为它与我的配置无关(这是真的)。我正在使用Umbraco 4.7.0。我必须在我的web.config添加“〜/ mini-profiler-results”到umbracoReservedUrls和umbracoReservedpaths。

解决方法

在安装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>

原文地址:https://www.jb51.cc/aspnet/252252.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐