المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Remoting server in Window Service



C# Programming
08-31-2009, 02:22 PM
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