MEF 和 WCF - AppDomain 问题
我当前正在运行最新的预览版 (#8),并且正在使用 WCF 服务。我使用 MEF 读取 WCF 服务库。我注意到,每当我从读取库的应用程序对其中一个库执行任何操作时,这些 WCF 库的 AppDomain 为 1,但是每当 WCF 服务收到通知时,它的 AppDomain 为 2?有没有一种方法可以确保收到通知的 WCF 服务与通过 MEF 读入的服务相同(或在同一 AppDomain 中)?
我基本上需要读取 WCF 服务上的配置数据,并确保数据始终存储在内存中,以便当收到任何通知时,我使用内存中的数据来帮助分析发送的内容。
I am currently running the latest preview (#8) and I am working with WCF services. I use MEF to read in the WCF Service Libraries. I have noticed that whenever I do any operation on one of the libraries from the application that read in the libraries, those WCF libraries have an AppDomain of 1, but whenever a WCF Service gets a notification, it has an AppDomain of 2? Is there a way to ensure that the WCF Service that gets notified is the same (or in the same AppDomain) as the one that was read in via MEF?
I basically need to read in configuration data on my WCF Service and ensure that the data is always stored in memory so when any notification comes in, that I am use the data in memory to help analyze what was sent in.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我想通了。我只需要让我的应用程序通过 MEF 读取 DLL 来告诉 DLL 作为服务主机。唯一的缺点是 DLL 必须告诉应用程序要使用的所有绑定和端点,以便应用程序可以设置正确的服务主机。
这是我所做的示例(只是为了使其工作,它没有向 DLL 请求设置的代码):
I figured it out. I just need to have my app that is reading in the DLLs via MEF to tell the DLL to be a service host. Only downside to this is the DLL will have to tell the application all the bindings and end-points to use so the application can set up the proper service host.
Here is a sample of what I did (just to make it work, it doesn't have the code to ask the DLL for the setup):