问题描述
当我退出 Fiddler 并意识到每个请求都被发送了 3 次(两次我得到 401.2 然后成功)时,我试图找出为什么我的网站在 IE9 中如此缓慢.我证实这发生在所有浏览器上,只是 Chrome 的速度掩盖了这一点(或者这可能与我在 IE 中的网站性能问题无关).
I was trying to track down why my site was so painfully slow in IE9 when I pulled out Fiddler and realised that every request is being sent 3 times (twice I get 401.2 and then a success). I verified this happens on all browsers, its just that Chrome's speed was masking this (or it could be that this has nothing to do with my sites performance issues in IE).
我已经在我的开始/结束请求处理程序中设置了断点,并且请求进入了一个 css 文件.它没有经过身份验证,响应以 401.2 发出,我仔细检查了我自己没有在任何地方设置响应状态,所以在 begin_request 和 end_request 之间的某处,状态正在更改为 401.2
I've set up break points in my begin/end request handlers and the request comes in for say a css file. It is not authenticated and the response goes out with a 401.2, I doubled checked that I'm not setting the response status anywhere myself, so somewhere between begin_request and end_request the status is changing to 401.2
注意:我有 runAllManagedModulesForAllRequests=true,所以我可以配置压缩,但是此设置不会影响这一点(从 Fiddler 中我可以看到).
Note: I have the runAllManagedModulesForAllRequests=true so I can configure compression, however this setting does not affect this (from what I can see from Fiddler).
总的来说,我对 kerberos/active 目录一无所知,但我无法理解这是每个请求的正常握手协议(可能是第一个请求?但不是全部).
I am very ignorant on kerberos/active directory in general but I just cannot fathom that this is a normal handshaking protocol for every single request (perhaps for the first? but not all).
我搜索了谷歌,但似乎没有任何帮助(添加/删除模块/身份验证提供程序等).我的意思是我的网站工作得很好,只有在你看到我看到重复请求的引擎盖下.注意:当我部署到生产环境时也会发生这种情况,因此它不是特定于服务器的问题.
I have scoured the googles and nothing seems to help (adding/removing modules/authentication providers, etc). I mean my site works just fine, its only once you look under the hood that I see the treplicated requests. Note: This also happens when I deploy to production so its not a server specific issue.
有人见过吗?提前致谢.
Has anyone ever seen this? thanks in advance.
推荐答案
我认为这就是 NTLM 身份验证的工作原理.该过程已讨论 这里.请注意,您需要将 AuthPersistSingleRequest 设置为 false 以减少 401 的数量
I think this is how NTLM authentication works. The process is discussed here. Note that you will want to set AuthPersistSingleRequest to false to cut down on the number of 401s
这篇关于Windows 身份验证的 asp.net mvc 应用程序中的每个资源(2 x 401.2 和 1 x 200)的 3 个请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!