C# – Hosting and Consuming WCF Service from Same Process

cnetwcfwcf-clientwcf-hosting

Can you become a client of a WCF Service from with the Process that is hosting the WCF Service? I have tried creating seperate App Domains within the same process and still no success. The service is confirmed to be available on Http, Net.TCP and Net.Pipe.

Thank you for any help!

Nat

Best Answer

I had this same issue, even while using the InProcFactory from ServiceModelEx.

It turns out, as described here, you need to set the ServiceBehavior to not UseSynchronizationContext.

[ServiceBehavior(UseSynchronizationContext = false)]
public class MyService : IMyService {}
Related Topic