asp.net – MiniProfiler.Stop()上的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标头后,服务器无法追加标头.”

有没有人见过这个?

解决方法

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

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

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

希望能帮助到你.

相关文章

### 创建一个gRPC服务项目(grpc服务端)和一个 webapi项目(...
一、SiganlR 使用的协议类型 1.websocket即时通讯协议 2.Ser...
.Net 6 WebApi 项目 在Linux系统上 打包成Docker镜像,发布为...
一、 PD简介PowerDesigner 是一个集所有现代建模技术于一身的...
一、存储过程 存储过程就像数据库中运行的方法(函数) 优点:...
一、Ueditor的下载 1、百度编辑器下载地址:http://ueditor....