.NET remoting manual configuration
- by Quandary
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 ?