【问题标题】:302 redirect pretty slow (IIS6)302 重定向非常慢(IIS6)
【发布时间】:2013-12-26 09:09:24
【问题描述】:

我的网站有一个奇怪的行为:

当点击需要认证的页面时,我们会这样处理:

  • http 模块检测到需要身份验证 =>

返回状态 401:

context.Response.StatusCode = 401;
// Prevents any other content from being sent to the browser
context.Response.SuppressContent = true;
// Directs the thread to finish, bypassing additional processing
context.ApplicationInstance.CompleteRequest();
  • 检测到重定向到身份验证表单并重定向到相应的登录表单:

重定向代码:

context.Response.Redirect(url, false);
// Directs the thread to finish, bypassing additional processing
context.ApplicationInstance.CompleteRequest();

当具有此代码的站点在 IIS7 上运行时,不会出现任何问题。但是在 IIS 6 中,登录表单需要 2 分钟才能加载(使用 IE、Firefox,有时它可以在 Chrome 中正常工作,但并非总是如此)。

使用 fiddler 时,我可以看到标题(302:重定向到最终登录表单)接收速度非常快,但浏览器等待“ServerDoneResponse”重定向,这至少需要 2 分钟。

一开始并没有 CompleteRequest(),我认为添加它可以解决问题,但它没有。

有人知道这个问题吗?

提前致谢

编辑:问题出现在 Windows 2003 R2 SP2 上托管的站点上

编辑#2:Fiddler 提供的信息:

ClientConnected:    14:27:39.219
ClientBeginRequest: 14:27:39.297
GotRequestHeaders:  14:27:39.297
ClientDoneRequest:  14:27:39.297
Determine Gateway:  0ms
DNS Lookup:         0ms
TCP/IP Connect:     0ms
HTTPS Handshake:    0ms
ServerConnected:    14:27:39.250
FiddlerBeginRequest:14:27:39.297
ServerGotRequest:   14:27:39.297
ServerBeginResponse:14:27:39.328
GotResponseHeaders: 14:27:39.328
ServerDoneResponse: 14:29:48.867
ClientBeginResponse:14:29:48.867
ClientDoneResponse: 14:29:48.867

Overall Elapsed:    00:02:09.5694285

【问题讨论】:

    标签: .net http redirect iis-6


    【解决方案1】:

    通过删除SuppressContent = true,II6 不再有问题。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-06-20
      • 2012-07-18
      • 2016-01-27
      • 2017-09-20
      • 1970-01-01
      • 1970-01-01
      • 2016-12-20
      • 1970-01-01
      相关资源
      最近更新 更多