Hi All,
I have created a simple remoting server inside a Window Service as :
TcpChannel tcpChannel = new TcpChannel(8085);
ChannelServices.RegisterChannel(tcpChannel,true);
WellKnownServiceTypeEntry entry = new WellKnownServiceTypeEntry("RemotingWindowSrvc", "RemotingWindowSrvc.MailFormat", "MailFormat", WellKnownObjectMode.SingleCall);
RemotingConfiguration.RegisterWellKnownServiceType(entry);
Then we try and make call to this server in my client as:
private void GetRemoteObject()
{
TcpChannel chan = new TcpChannel();
ChannelServices.RegisterChannel(chan);
MailFormat obj = (MailFormat)Activator.GetObject(typeof(MailFormat), "tcp://localhost:8085/MailFormat");
obj.sendUserRegistration("...");
}
}
MailFormat: is the name of the Class, being called here.
But upon calling "obj.sendUserRegistration("...");", client hangs indefinitely.
please help me with this.
Thanks,
Puneet
Comments
So is MailFormat a class that you have created?
if so - what's going on in the sendUserRegistration method? can you post it?
Also - is it hanging indefinitely - or if you wait like 10 minutes does it time out?
Thanks a lot for the reply, I have been able to solve this problem.
It was hanging cause, it wasn't able to resolve the function name. But once I signed the assembly and deployed it in GAC, it was able to recognize it and call the function.
I am putting the code for your reference:
Dim ch As TcpChannel = New TcpChannel(8085)
ChannelServices.RegisterChannel(ch)
RemotingConfiguration.RegisterWellKnownServiceType( _
GetType(TrialClassLib.MailFormat), "myRemoteObject", WellKnownObjectMode.Singleton)