.NET Remoting problem - exception "Object Reference not set to ins

.NET Remoting problem - exception "Object Reference not set to ins

Post by U29vcmFqIF » Mon, 27 Sep 2004 19:45:03


There can be a reson of the mistake in the configuration files (either
client or server side .config files). Try to do the hosting and activation
through code. I mean create the host channel with port and host the object
and in the client side access the object through this ip address. You can get
examples from net.

This is a small example: (it is in VB.NET)

in OnStart Event of Windows Service (Host)
ChannelServices.RegisterChannel(New TcpChannel(12345)
RemotingConfiguration.ApplicationName = "CustomerMgr"

in the Client Application

Dim Attribs(0) As Object
Dim CustMgr As WindowsServiceSrvr.CustomerMgr
Dim CustomerMessage As String
Attribs(0) = New UrlAttribute("tcp://localhost:12345/CustomerMgr")
'Note: The CustomerMgr is the name you have defined in the Host by giving
the line
' RemotingConfiguration.ApplicationName = "CustomerMgr". Both should
be same
CustMgr =
Activator.CreateInstance(GetType(WindowsServiceSrvr.CustomerMgr), Nothing,

Now you can call the methods of CustMgr Object. Hope this may help you. Once
it is working successfully analyze the contents of the config file. There can
be some issues with that:

Example Config Files:
<application name = "CustomerMgr">
<activated type ="WindowsServiceSrvr.CustomerMgr,CustomerMgr"
objecturi = "CustomerMgr"/>
<channel ref = "Tcp" port ="12345"></channel>
<formatter ref="binary">

in Client:

<application name = "CustomerMgr">
<client url = "tcp://localhost:12345">
<activated type ="WindowsServiceSrvr.CustomerMgr,CustomerMgr"/>
<channel ref = "Tcp"/>

Please compare the same with your config file. Hope this will help you.


Microsoft Community Star

"aacool" wrote: