I am somewhat new to WCF and I am running into a very simple design issue which I assume has well-established answers. I created a (single-instance) main application that does all the 'business logic': connects to a database and a third-party API, executes admin user commands etc. This application is meant to be run on a server machine, and my next step is to create a WcfServiceLibrary
on top so that end-users can execute commands remotely using Wcf clients.
Logically the WcfServiceLibrary
makes a reference to the main application assembly. Call me naive but I thought this would let me access the main application objects and methods. Well it does but by creating a duplicate of the main application within the WcfServiceLibrary
process, which is a no-go. (I also discovered that when accessed from within the WcfServiceLibrary a single-instance application is being duplicated!)
How to resolve this issue? So far I am thinking of the following:
- Self-host the Wcf service within the main application: possible but I would be losing the clean separation between 'business logic' and service logic
- Use IPC techniques to communicate between main application and
WcfSrviceLibrary
: this looks like an overkill as it creates another layer of server-client interface (except perhaps if I use out-of-process COM) - Any other way?
Thanks in advance for your help! I want to believe there's a simple solution to this problem round the corner...!