WCF 服务之间的共享会话 [英] Sharing session between WCF services
问题描述
我一直致力于拆分 Web 应用程序的应用层和 Web 层.在应用层,我设法将业务逻辑分离成一堆使用 WCF 代理公开的服务.问题在于这些服务与另一个使用大型 CLR 对象作为其主要通信方式的遗留应用程序进行通信.为了保持快速,在我第一次创建这个对象后,我一直在会话中保留它的副本.现在我知道 WCF 可以执行会话,但是会话存储是按服务进行的,而我的业务逻辑现在被拆分为多个服务(应该如此).
I have been working on splitting up the app tier and web tier of a web application. In the app tier, I managed to separate the business logic into a bunch of services exposed using WCF proxies. The problem is that these services talk to another legacy application that uses a large CLR object as its primary means of communication. To keep things quick, I had been keeping a copy of this object in the session after I created it the first time. Now I know that WCF can do sessions, but the session storage is per service whereas my business logic is now split into multiple services (as it should be).
现在问题:
- 有没有办法在同一主机上托管的 WCF 服务之间共享会话存储?
- 这是我应该做的事情吗?
- 如果不是,那么这里的最佳做法是什么?
这可能不是第一次有人在服务器上拥有大型业务对象.不幸的是,我确实需要为每个用户缓存这个对象(因此是会话).
This is probably not the first time somebody’s had a large business object on the server. Unfortunately for me, I really do need to cache this object per user (hence the session).
答案可能很明显,只是我没有看到.请帮忙!
It’s possible the answer is obvious and I'm just not seeing it. Help please!
推荐答案
我认为实例上下文共享可以提供帮助
I think instance context sharing can help
http://msdn.microsoft.com/en-us/library/aa354514.aspx
这篇关于WCF 服务之间的共享会话的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!