0

我正在尝试将 MiniProfiler 设置为在我们所有的环境中运行,而不仅仅是在我们的本地机器上运行。据我了解,StackOverflow 在生产环境中运行 MiniProfiler 没有任何问题。当我在 Chrome 中打开我的开发人员工具并转到 StackOverflow 网站上的网络选项卡时,我没有看到以下 URL 的任何帖子:

mini-profiler-resources/results

当我查看我们网站上的网络选项卡时,我确实看到了许多指向此 URL 的帖子。我在 Global.cs 中使用的代码是:

protected void Application_Start()
{
    MiniProfiler.Settings.Results_Authorize = IsUserAllowedToSeeMiniProfilerUI;
    MiniProfiler.Settings.Results_List_Authorize = IsUserAllowedToSeeMiniProfilerUI;
}

protected void Application_BeginRequest()
{
    MiniProfiler.Start();
}

protected void Application_EndRequest()
{
    MiniProfiler.Stop();
}

private static Boolean IsUserAllowedToSeeMiniProfilerUI(HttpRequest request)
{
    return request.IsLocal || request.RequestContext.HttpContext.User.IsInRole("Admin");
}

我在这里做错了吗?我唯一能想到的是它没有启动分析会话,但它不会分析用户请求。MiniProfiler UI 没有显示,因此该部分工作正常,但是所有请求仍在发出,RenderIncludes 方法正在将 js 代码加载到 DOM 中。

谢谢!

4

0 回答 0