.NET remoting manual configuration

Posted by Quandary on Stack Overflow See other posts from Stack Overflow or by Quandary
Published on 2010-05-27T12:59:08Z Indexed on 2010/05/27 13:01 UTC
Read the original article Hit count: 345

Filed under:
|
|
|
|

Question: In .NET remoting, I configure the client like this from a config file

RemotingConfiguration.Configure("AsyncRemoteAPIclient.exe.config", False)
Dim obj As New RemoteAPI.ServiceClass()

(with this AsyncRemoteAPIclient.exe.config)

<system.runtime.remoting>
<application>
  <client>
    <wellknown
       type="RemoteAPI.ServiceClass, ServiceClass"
       url="http://localhost:8080/ServiceClass.rem"
        />
  </client>
  <channels>
    <channel
       ref="http"
       port="0"
        />
  </channels>
</application>

But when I replace the config file with manual configuration with the below code, it stops working, and starts complaining "ServiceClass or dependency not found".

        Dim chan As New System.Runtime.Remoting.Channels.Http.HttpChannel(0)
        System.Runtime.Remoting.Channels.ChannelServices.RegisterChannel(chan, False)

        ' Create an instance of the remote object
        Dim obj As RemoteAPI.ServiceClass
        obj = CType(Activator.GetObject(GetType(RemoteAPI.ServiceClass), "http://localhost:8080/ServiceClass.rem"), RemoteAPI.ServiceClass)

What's wrong ?

© Stack Overflow or respective owner

Related posts about c#

Related posts about ASP.NET