Using an WCF service in a ServiceStack service


I need to use an external WCF service in my ServiceStack Service.

But which project (“main” or ServiceInterface) do I add the Service Reference to?

If I add it to the “main”, I can’t use it in the ServiceInterface project (adding the “main” projects results in a circular reference)

if I add it to the ServiceInterface, I get “no configuration file was found for your application, or because no endpoint element matching this contract could be found in the client element.” - probably because it is looking for this in the Web.Config, but it actually resides in the ServiceInterface’s app.config


If it’s an external WCF Service it’s unrelated to ServiceStack, the ServiceInterface project would then be the same as any other .NET class project.

But the Web or App.config needs to be in the Host project (i.e. which already contains the Web.config). The code can be anywhere but if you put it in the host project then you’d want to implement an interface that your ServiceInterface can reference, the concrete implementation could then be registered in the IOC and injected into your Service like any other dependency.

Thanks mythz!

I also found, that simply moving the system.serviceModel generated in the ServiceInterface project’s app.config, to the host project’s web.config works just fine.