如何消除IIS / ASP.NET双握手?

时间:2022-02-03 06:10:50

I have a .NET 2.0 ClickOnce application that runs in a corporate environment and it's setup to work via Windows Authentication.

我有一个在企业环境中运行的.NET 2.0 ClickOnce应用程序,它可以通过Windows身份验证进行设置。

So the users download the app via ClickOnce and then it connects to an IIS server and communicates via Web Service calls.

因此,用户通过ClickOnce下载应用程序,然后连接到IIS服务器并通过Web服务调用进行通信。

The problem is that for every single call there is a double handshake. The first call yields a 401 and invites the client to negotiate. The second call succeeds since the client sends the authentication token.

问题是每次呼叫都有双握手。第一个调用产生401并邀请客户进行协商。第二次调用成功,因为客户端发送身份验证令牌。

Is there anyway to eliminate this double handshake? Because it put a tremendous overhead on the latency of the application and makes it seem very sluggish.

反正有没有消除这种双重握手?因为它给应用程序的延迟带来了巨大的开销,并使它看起来非常缓慢。

Thanks

2 个解决方案

#1


There actually is a solution, it turns out: WebRequest.PreAuthenticate Check out an article by Rick Strahl.

实际上有一个解决方案,结果是:WebRequest.PreAuthenticate查看Rick Strahl撰写的一篇文章。

#2


This "double handshake" is a integral part of NTLM's challenge response model. Your only option would be to change the authentication type.

这种“双握手”是NTLM挑战响应模型不可或缺的一部分。您唯一的选择是更改身份验证类型。

Alternatively, you try re-using the connection for web service calls.

或者,您尝试重新使用连接进行Web服务调用。

#1


There actually is a solution, it turns out: WebRequest.PreAuthenticate Check out an article by Rick Strahl.

实际上有一个解决方案,结果是:WebRequest.PreAuthenticate查看Rick Strahl撰写的一篇文章。

#2


This "double handshake" is a integral part of NTLM's challenge response model. Your only option would be to change the authentication type.

这种“双握手”是NTLM挑战响应模型不可或缺的一部分。您唯一的选择是更改身份验证类型。

Alternatively, you try re-using the connection for web service calls.

或者,您尝试重新使用连接进行Web服务调用。