加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > asp.Net > 正文

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

发布时间:2020-12-16 04:34:12 所属栏目:asp.Net 来源:网络整理
导读:我刚刚使用nuget将Mini Profiler添加到我的MVC3项目中,我已按照基本步骤进行设置.在Application_BeginRequest()上启动配置文件并在Application_EndRequest()上停止它 protected void Application_BeginRequest() { if (Request.IsLocal) { MiniProfiler.Star
我刚刚使用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();
}

希望能帮助到你.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读