现在的位置: 首页 > 综合 > 正文

How to dispose a .Net Remoting Host Server(Server Activated Objects)

2013年10月26日 ⁄ 综合 ⁄ 共 763字 ⁄ 字号 评论关闭

1、First and foremost you should refer your own Assembly then define a Class derived from "MarshalByRefObject" !

2、Then you should register its  ports : Http or Tcp like this:

    HttpChannel cnl=new HttpChannel(7608);

    ChannelServices.RegisterChannel(cnl);

    or

     TcpChannel cnl=new TcpChannel(7711);

     ChannelServices.RegisterChannel(cnl);

3、define a ApplicationName---be equal to IIS application,like this: 

      RemotingConfiguration.ApplicationName="TranserRemotingService"

4、define a  Well Known Service Type Entry

     WellKnownServiceTypeEntry ETR=new(WellKnownServiceTypeEntry (typeof("your class"),"OBJURL",WellKnownObjectMode.SingleCall  or WellKnownObjectMode.Singleton ));

5、Register this Entry

RemotingConfiguration.RegisterWellKnownServiceType(ETR);

 Ok,now you can establish your client to test your Host Server!

抱歉!评论已关闭.