Remoting Object in Window Service - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Remoting Object in Window Service

puneetshadijapuneetshadija Posts: 4Member
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

  • DataDinkDataDink Posts: 135Member
    you know if you guys just use WCF services you don't have to deal with all this stuff.

    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?


  • puneetshadijapuneetshadija Posts: 4Member
    Hi,

    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)
  • yadhavyadhav Posts: 1Member
    how to two system are chating ... codeing pls
Sign In or Register to comment.