private static void _SignalFirstInstance(string channelName, IList <string> args) { var secondInstanceChannel = new IpcClientChannel(); ChannelServices.RegisterChannel(secondInstanceChannel, true); string remotingServiceUrl = "ipc://" + channelName + "/" + _RemoteServiceName; // Obtain a reference to the remoting service exposed by the first instance of the application var firstInstanceRemoteServiceReference = (_IpcRemoteService)RemotingServices.Connect(typeof(_IpcRemoteService), remotingServiceUrl); // Pass along the current arguments to the first instance if it's up and accepting requests. if (firstInstanceRemoteServiceReference != null) { // Allow the first instance to give itself user focus. // This could be done with ASFW_ANY if the IPC call is expensive. int procId = firstInstanceRemoteServiceReference.GetProcessId(); NativeMethods.AllowSetForegroundWindow(procId); firstInstanceRemoteServiceReference.InvokeFirstInstance(args); } }