我正在研究ASP.NET WebForms应用程序,并尝试实现MiniProfiler。 我使用的是NuGet(4.0.138)的最新版本,并在Global.asax和web.config中实现了所有必要步骤。
Global.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
Web.config:
<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.RenderIncludes()实际上返回一些数据。
我需要RenderIncludes(),因为它应该生成JS代码,以显示格式良好的结果。