WCF客户端耗时多ASMX服务,使用HTTP饼干 [英] WCF client consuming multiple asmx service that uses HTTP Cookies
问题描述
我试图使用相同的HTTP cookie(实际上是一个ASMX的SessionID),在多个WCF客户端终结点。
I am trying to use the same http cookie (in effect a asmx sessionid), in multiple WCF client endpoints.
服务器具有几个端点,其中一个是:
The server has several endpoints, one of them is:
登录()< - 创建的HTTP cookie是服务器ASP.NET的SessionID
退出()< - 销毁同样的Cookie
AuthenticationService.asmx
Login() <- Creates a HTTP cookie that is the servers ASP.NET sessionid
Logout() <- Destroys the same cookies
DoSomething的()&LT; - Requeres从AuthenticationService.asmx一个有效的cookie
SomeOtherService.asmx
DoSomeThing() <- Requeres a valid cookie from the AuthenticationService.asmx.
我如何跨多个终端共享的HTTP cookie。
How can I share the HTTP Cookie across multiple endpoints.
我没有在服务器code控制,并且必须使用WCF。
I dont have control over the server code, and the must use WCF.
推荐答案
有一个看的这篇文章。
它说明了如何手动WCF客户端代理管理cookies。更多precisely WCF公开的API,让你从HTTP响应中提取饼干,并以同样的方式,手动设置一个cookie到一个HTTP请求。
你将要做的就是利用这一机制以手动提取从给定的客户端代理收到的HTTP响应的cookie,并分配相同的cookie被其他客户端代理,以不同的服务发送的HTTP请求。
<一个href=\"http://social.msdn.microsoft.com/Forums/en-US/wcf/thread/624fb3f9-222d-4795-9140-fe9ef3934361/\"相对=nofollow>在MSDN论坛这个线程介绍了如何通过使用WCF消息督察应用程序中的每一个服务调用做到这一点。
This thread on the MSDN Forums explains how to do this for every service call in an application by using WCF Message Inspectors.
更新:
我已经写了一个博客张贴有关如何解决这个问题。你可以阅读它在这里一>
I've written a blog post about how to solve this issue. You can read it over here.
这篇关于WCF客户端耗时多ASMX服务,使用HTTP饼干的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!