Windows 身份验证的 asp.net mvc 应用程序中的每个资源(2 x 401.2 和 1 x 200)的 3 个请求

3 requests for every resource (2 x 401.2 and 1 x 200) in a windows authenticated asp.net mvc app(Windows 身份验证的 asp.net mvc 应用程序中的每个资源(2 x 401.2 和 1 x 200)的 3 个请求)
本文介绍了Windows 身份验证的 asp.net mvc 应用程序中的每个资源(2 x 401.2 和 1 x 200)的 3 个请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我退出 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 个请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

c# Generic Setlt;Tgt; implementation to access objects by type(按类型访问对象的C#泛型集实现)
InvalidOperationException When using Context Injection in ASP.Net Core(在ASP.NET核心中使用上下文注入时发生InvalidOperationException)
how do i pass parameters to aspnet reportviewer(如何将参数传递给aspnet report查看器)
Bind multiple parameters from route and body to a model in ASP.NET Core(在ASP.NET Core中将路由和主体中的多个参数绑定到一个模型)
Custom model binding in AspNet Core WebApi?(AspNet Core WebApi中的自定义模型绑定?)
How to minify in .net core mvc view?(如何在.Net核心MVC视图中缩小?)