[英]MiniProfiler Doesn't work
I just created a new MVC 4 Basic project and added the package to the project and the needed code to the layout but nothing happened after first run. 我刚刚创建了一个新的MVC 4 Basic项目,并将该软件包添加到项目中,并将所需的代码添加到布局中,但在首次运行后没有任何反应。
This is the Layout: 这是布局:
@using StackExchange.Profiling;
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
<title>@ViewBag.Title</title>
@Styles.Render("~/Content/css")
@Scripts.Render("~/bundles/modernizr")
</head>
<body>
@MiniProfiler.RenderIncludes()
@RenderBody()
@Scripts.Render("~/bundles/jquery")
@RenderSection("scripts", required: false)
</body>
</html>
Update 更新
I've added this code to the global.asax.cs
我已将此代码添加到global.asax.cs
protected void Application_BeginRequest()
{
MiniProfiler.Start();
}
now this code appears in the HTML code: 现在这段代码出现在HTML代码中:
<script async type="text/javascript" id="mini-profiler" src="/mini-profiler-resources/includes.js?v=xwYPDDH1blvqmxgsBweNC++H7CFU3KGQ+zFcVlJPsXw=" data-version="xwYPDDH1blvqmxgsBweNC++H7CFU3KGQ+zFcVlJPsXw=" data-path="/mini-profiler-resources/" data-current-id="6da0f73c-fa89-447b-92b1-56dc532947f4" data-ids="6da0f73c-fa89-447b-92b1-56dc532947f4" data-position="left" data-trivial="false" data-children="false" data-max-traces="15" data-controls="false" data-authorized="true" data-toggle-shortcut="Alt+P" data-start-hidden="false"></script>
but the /mini-profiler-resources/includes.js?v=xwYPDDH1blvqmxgsBweNC++H7CFU3KGQ+zFcVlJPsXw=
url returns a 404 error. 但是/mini-profiler-resources/includes.js?v=xwYPDDH1blvqmxgsBweNC++H7CFU3KGQ+zFcVlJPsXw=
url会返回404错误。
Thanks to spaceman the problem solved! 感谢太空人,问题解决了! the problem was from the 404 error solved by adding this code to web.config
问题来自于通过将此代码添加到web.config
解决的404错误
<system.webServer>
<handlers>
<add name="MiniProfiler" path="mini-profiler-resources/*" verb="*" type="System.Web.Routing.UrlRoutingModule" resourceType="Unspecified" preCondition="integratedMode" />
have you added the initialise code to the global.asax file? 您是否已将初始化代码添加到global.asax文件中?
you need to hook into the application_beginrequest and application_endrequest methods also. 你还需要挂钩application_beginrequest和application_endrequest方法。
http://www.codeproject.com/Articles/516627/MiniProfilerplus-plusInstallationplusandplusSetup http://www.codeproject.com/Articles/516627/MiniProfilerplus-plusInstallationplusandplusSetup
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.