tags:

views:

240

answers:

1

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.

A: 

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 enpoints to use so the application can setup the proper service host.

Here is a sample of what I did (just to make it work, it doesnt have the code to ask the DLL for the setup)

foreach (MYINTERFACE mod in this.Modules) { ServiceHost serviceHost = new ServiceHost(mod, new Uri[] { new Uri("BINDING URL") }); var binding = new NetTcpBinding(); binding.Security.Mode = SecurityMode.None; var serviceEndpoint = serviceHost.AddServiceEndpoint(typeof(ENDPOINT TYPE), binding, ""); serviceHost.Open(); this.ServiceHosts = new List(); this.ServiceHosts.Add(serviceHost); }

Travyguy9