.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


i

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.RegisterActivatedServiceType(GetType(WindowsServiceSrvr.CustomerMgr))
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,
Attribs)

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:
Host:
<configuration>
<system.runtime.remoting>
<application name = "CustomerMgr">
<service>
<activated type ="WindowsServiceSrvr.CustomerMgr,CustomerMgr"
objecturi = "CustomerMgr"/>
</service>
<channels>
<channel ref = "Tcp" port ="12345"></channel>
<formatter ref="binary">
</formatter>
</channels>
</application>
</system.runtime.remoting>
</configuration>

in Client:

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

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

Regards

Sooraj
Microsoft Community Star


"aacool" wrote: