MiniProfiler 未加载,因为未找到探查器路由
MiniProfiler does not load because profiler route is not found
我安装了 MiniProfiler.Mvc5
nuget 并输入了以下内容:
web.config:
<system.webServer>
<modules runAllManagedModulesForAllRequests="true" />
</system.webServer>
注册全局过滤器:
filters.Add(new StackExchange.Profiling.Mvc.ProfilingActionFilter());
Global.asax.cs
void Application_Start()
{
MiniProfiler.Configure(new MiniProfilerOptions
{
RouteBasePath = "~/profiler",
}
.ExcludeType("SessionFactory")
.ExcludeMethod("Flush")
.AddViewProfiling());
AreaRegistration.RegisterAllAreas();
FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
System.Web.Http.GlobalConfiguration.Configure(WebApiConfig.Register);
RouteConfig.RegisterRoutes(RouteTable.Routes);
BundleConfig.RegisterBundles(BundleTable.Bundles);
}
void Application_BeginRequest()
{
MiniProfiler.StartNew();
}
void Application_End()
{
MiniProfiler.Current?.Stop();
}
_Layout.cshtml
@MiniProfiler.Current.RenderIncludes()
</body>\
呈现 html:
<script async="async" id="mini-profiler" src="/profiler/includes.min.js?v=4.1.0+c940f0f28d" data-version="4.1.0+c940f0f28d" data-path="/profiler/" data-current-id="b0ff50dd-5d1d-4fc2-8bac-50d8f316fb03" data-ids="b0ff50dd-5d1d-4fc2-8bac-50d8f316fb03" data-position="Left" data-authorized="true" data-max-traces="15" data-toggle-shortcut="Alt+P" data-trivial-milliseconds="2.0" data-ignored-duplicate-execute-types="Open,OpenAsync,Close,CloseAsync"></script>
在 http://localhost:64755/profiler/includes.min.js?v=4.1.0+c940f0f28d
上未找到获取 404
在 system.webServer
下的 web.config
中添加此 handlers
标签:
<handlers>
<add name="MiniProfiler" path="profiler/*" verb="*" type="System.Web.Routing.UrlRoutingModule" resourceType="Unspecified" preCondition="integratedMode" />
</handlers>
我改为使用 Glimpse。设置起来要容易得多。刚刚...
- 安装 Glimpse.Mvc5 nuget
- 浏览至 http://localhost:port/Glimpse.axd 以配置其余部分。
- 完成
我安装了 MiniProfiler.Mvc5
nuget 并输入了以下内容:
web.config:
<system.webServer>
<modules runAllManagedModulesForAllRequests="true" />
</system.webServer>
注册全局过滤器:
filters.Add(new StackExchange.Profiling.Mvc.ProfilingActionFilter());
Global.asax.cs
void Application_Start()
{
MiniProfiler.Configure(new MiniProfilerOptions
{
RouteBasePath = "~/profiler",
}
.ExcludeType("SessionFactory")
.ExcludeMethod("Flush")
.AddViewProfiling());
AreaRegistration.RegisterAllAreas();
FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
System.Web.Http.GlobalConfiguration.Configure(WebApiConfig.Register);
RouteConfig.RegisterRoutes(RouteTable.Routes);
BundleConfig.RegisterBundles(BundleTable.Bundles);
}
void Application_BeginRequest()
{
MiniProfiler.StartNew();
}
void Application_End()
{
MiniProfiler.Current?.Stop();
}
_Layout.cshtml
@MiniProfiler.Current.RenderIncludes()
</body>\
呈现 html:
<script async="async" id="mini-profiler" src="/profiler/includes.min.js?v=4.1.0+c940f0f28d" data-version="4.1.0+c940f0f28d" data-path="/profiler/" data-current-id="b0ff50dd-5d1d-4fc2-8bac-50d8f316fb03" data-ids="b0ff50dd-5d1d-4fc2-8bac-50d8f316fb03" data-position="Left" data-authorized="true" data-max-traces="15" data-toggle-shortcut="Alt+P" data-trivial-milliseconds="2.0" data-ignored-duplicate-execute-types="Open,OpenAsync,Close,CloseAsync"></script>
在 http://localhost:64755/profiler/includes.min.js?v=4.1.0+c940f0f28d
在 system.webServer
下的 web.config
中添加此 handlers
标签:
<handlers>
<add name="MiniProfiler" path="profiler/*" verb="*" type="System.Web.Routing.UrlRoutingModule" resourceType="Unspecified" preCondition="integratedMode" />
</handlers>
我改为使用 Glimpse。设置起来要容易得多。刚刚...
- 安装 Glimpse.Mvc5 nuget
- 浏览至 http://localhost:port/Glimpse.axd 以配置其余部分。
- 完成