First of all: I do really know what Google is and, yes, there are several existing threads for this topic, but I just did not find what I am searching for.
The situation might be complex and hopefully I won't forget to explain anything.
I'll come to the question/problem:
I've got an application, which is only allowed to run once on a system.
So I firstly locked this with a mutex, that's not enough because there is a requirement, that the application must accept command line arguments - even if it's already running.
Ok, I Googled it and finally tried the solution "WCF for Single Instance from codeproject written by KN.Sudha" with some modifications (only some structure issues, nothing that changed the internal behavior). Now I am able to get the already running instance of my application when trying to start a new one (with and without arguments). I can call the methods with [OperationContract] Attribute in my class which inherits from the interface with the [ServiceContract] Attribute.
So far so good.
Now when I call a second instance from a command line with arguments (sure, I mean the application path and then arguments), the call is transmitted over WCF to the first running instance to be executed, but I now want to wait for the result of the call and display the string within my external console, where I started the second instance with the arguments (the second instance exits after the call, the command line is still running for further activities).
If anyone has any idea to solve this, it would be very nice to share with the stackoverflow community :)