Asp.net
MVC-Mini-Profiler - Web 表單 - 找不到 /mini-profiler-results
我正在嘗試讓 MVC-mini-profiler 與網路表單一起使用。
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>