<p>Given that my client code knows everything it needs to about the remoting object, what's the simplest way to connect to it?</p>

<p>This is what I'm doing at the moment:</p>

<pre><code>ChannelServices.RegisterChannel(new HttpChannel(), false);

RemotingConfiguration.RegisterWellKnownServiceType(
    typeof(IRemoteServer), "RemoteServer.rem", WellKnownObjectMode.Singleton);

MyServerObject = (IRemoteServer)Activator.GetObject(
    typeof(IRemoteServer),
    String.Format("tcp://{0}:{1}/RemoteServer.rem", server, port));
</code></pre>

[{'answer_id': 26307, 'author': 'Community', 'author_id': -1, 'author_profile': 'https://Stackoverflow.com/users/-1', 'pm_score': 0, 'selected': False, 'text': "<p>WCF.  </p>\n\n<p>I have used IPC before there was a WCF, and believe me, IPC is a bear.  And it isn't documented fully/correctly.</p>\n\n<p>What’s the simplest way to connect to a .NET remote server object?  WCF.</p>\n"}, {'answer_id': 27450, 'author': 'Ishmaeel', 'author_id': 227, 'author_profile': 'https://Stackoverflow.com/users/227', 'pm_score': 2, 'selected': True, 'text': "<p>The first two lines are in the server-side code, for marshaling out the server object, yes?</p>\n\n<p>In that case, yes, the third line is the simplest you can get at client-side.</p>\n\n<p>In addition, you can serve out additional server-side objects from the <strong>MyServerObject</strong> instance, if you include public accessors for them in <strong>IRemoteServer</strong> interface, so, accessing those objects become the simple matter of method calls or property accesses on your main server object, so you don't have to use activator for every single thing:</p>\n\n<pre><code>//obtain another marshalbyref object of the type ISessionManager:\nISessionManager = MyServerObject.GetSessionManager();\n</code></pre>\n"}]
['https://Stackoverflow.com/questions/25982', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2373/']