302重定向速度很慢(IIS6)

4

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

当访问需要身份验证的页面时,我们采用以下方法处理:

  • 一个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的站点上
第二次编辑: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
1个回答

1
通过移除 SuppressContent = true,II6 就不再存在问题。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接