I have downloaded a simple .Net remoting example from here http://www.codeproject.com/Articles/8771/Simple-but-potentially-useful-example-of-NET-Remot . The example works. The server side code is called by the client. Now when I copy that client code into my own C# project like the code below, it gives me a SocketException: No connection could be made because the target machine actively refused it.
EDIT 1 START
Its even getting stranger. When I have a test project as a client that works, and I add that working project to the solution I am working on, and run a new debug instance of the project (it is the only project ran from the solution on that moment), it gives me the SocketException: No connection could be made because the target machine actively refused it. It looks like it has something to do with a solution based configuration or so.
END 1 END
Because of this strange behavior I wanted to see if I was missing something. So I created a new (winforms) project in a new solution and I put the exact same code in the new form1_load event. And it works, the server side code is called by this newly created winforms application. How is it possible that one application can connect over remoting to execute server side code, and another application can't, by using the exact same code? And yes, I turned Windows Firewall off, and I do not have any other firewall.
And all of the above is tested on one computer. So there is no physical network involved.
Any suggestions?
[STAThread]
static void Main()
{
TcpClientChannel channel = new TcpClientChannel();
ChannelServices.RegisterChannel(channel);
IProcessActivator.IProcessActivator process_activator = (IProcessActivator.IProcessActivator)Activator.GetObject
(
typeof(IProcessActivator.IProcessActivator),
"tcp://localhost:9000/ProcessActivator"
);
process_activator.Run("IExplore.exe", @"http://www.codeproject.com");
}