MVC-Mini-Profiler - Web Forms - Can't find /mini-profiler-results

混江龙づ霸主 提交于 2019-11-28 20:32:38

问题


I'm trying to get MVC-mini-profiler to work with webforms.

NUGET
I've installed the Nuget package.

PM> Install-Package MiniProfiler

Head
I have this in the head section of my website.

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

DAL
I'm using it inside one function as a POC. This is not in the Global.asax (I dont know if that's required or not.)

profiler = MiniProfiler.Start();

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

MvcMiniProfiler.MiniProfiler.Stop();

Result
It renders a <div class="profiler-results left"></div> tag on my page, but it is empty.

If I look at the chrome console I see a 404 trying to find: http://example.com/mini-profiler-results?id=339d84a7-3898-429f-974b-64038462d59a&popup=1

Question
Am I missing a step to get the /mini-profiler-results link to work?

Answer
The response I marked as answer led me to think that it had nothing to do with my configuration (which is true). I am using Umbraco 4.7.0. I had to add "~/mini-profiler-results" to umbracoReservedUrls and umbracoReservedPaths in my web.config.


回答1:


The following page worked just great for me after installing the NuGet package:

<%@ 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://stackoverflow.com/questions/6320103/mvc-mini-profiler-web-forms-cant-find-mini-profiler-results

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!