MiniProfiler.Stop()上的MVC Mini Profiler异常

时间:2011-07-23 03:24:28

标签: asp.net asp.net-mvc asp.net-mvc-3 mvc-mini-profiler

我刚刚使用nuget将Mini Profiler添加到我的MVC3项目中,我已按照基本步骤进行设置。在Application_BeginRequest()上启动配置文件并在Application_EndRequest()

上停止它
    protected void Application_BeginRequest()
    {
        if (Request.IsLocal)
        {
            MiniProfiler.Start();
        }

    }

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

MiniProfiler.Stop()抛出异常 - “在发送HTTP标头后,服务器无法追加标头。”

还有其他人看过这个吗?

2 个答案:

答案 0 :(得分:7)

老问题,但无论如何回答。

由某些组件(在我的情况下为SignalR)引起的问题调用HttpResponse.Flush。 通过从分析中排除SignalR来解决此问题。以下是我们所做的简单版本。

if (Request.IsLocal && !Request.Path.StartsWith("/signalr"))
{
    MiniProfiler.Start();
}

希望它有所帮助。

答案 1 :(得分:1)

这似乎与Combres(http://combres.codeplex.com/)有关。如果我忽略了我的js和css的请求已被合并并使用combres压缩,那么探查器似乎工作得更好(没有抛出异常)