我正在开发 ASP.NET WebForms 应用程序并尝试实现 MiniProfiler。我有来自 NuGet (4.0.138) 的最新版本,我在 Global.asax 和 web.config 中实现了所有必要的步骤。
全球.asax:
Sub Application_Start(sender As Object, e As EventArgs)
MiniProfiler.Configure(New MiniProfilerOptions With {
.RouteBasePath = "~/mini-profiler-resources",
.StackMaxLength = 256,
.TrackConnectionOpenClose = True
})
End Sub
Sub Application_BeginRequest(ByVal sender As Object, ByVal e As EventArgs)
MiniProfiler.StartNew()
End Sub
Sub Application_EndRequest()
MiniProfiler.Current?.Stop()
End Sub
网络配置:
<handlers>
<add name="MiniProfiler" path="mini-profiler-resources/*" verb="*" type="System.Web.Routing.UrlRoutingModule" resourceType="Unspecified" preCondition="integratedMode" />
</handlers>
Default.aspx(在底部的某处):
<%=MiniProfiler.Current.RenderIncludes() %>
<%=MiniProfiler.Current.Render() %>
问题是 MiniProfiler.Current.RenderIncludes() 总是返回一个空字符串,而 MiniProfiler.Current.Render() 实际上返回一些数据。
我需要 RenderIncludes() 因为它应该生成 JS 代码来显示格式良好的结果。