繁体   English   中英

远程对象和远程连接

[英]Remoting objects and remote connections

我正在使用.NET远程处理一些基于观察者的简单IPC。 我一直遇到两个问题:

  1. 如果几分钟内我没有从客户端对远程对象进行任何调用,则在尝试调用时会引发错误,并指定已断开连接。 我怎样才能保持下去?
  2. 我似乎无法通过TCP从其他计算机接受客户端。 我正在使用这样配置的TcpChannel:

     BinaryServerFormatterSinkProvider serverProv = new BinaryServerFormatterSinkProvider(); serverProv.TypeFilterLevel = TypeFilterLevel.Full; BinaryClientFormatterSinkProvider clientProv = new BinaryClientFormatterSinkProvider(); IDictionary props = new Hashtable(); props["port"] = port; TcpChannel channel = new TcpChannel( props, clientProv, serverProv ); ChannelServices.RegisterChannel( channel, false ); RemotingConfiguration.RegisterWellKnownServiceType( typeof( Controller ), "Controller", WellKnownObjectMode.Singleton ); 

当客户端应用尝试连接时( m_Controller = (Controller)RemotingServices.Connect( typeof( Controller ), "tcp://" + ip + ":2594/Controller" ) ) ,它总是超时。 我没有在防火墙后面,并且端口已正确转发。 由于某些原因,我可以将此端口用于基于套接字的应用程序,但不能用于远程处理。 请帮忙!

  1. 您是否已初始化Controller对象的生存期? 请参阅http://www.diranieh.com/NETRemoting/InDepthRemoting.htm
  2. 在这里查看我的答案: 通过TCP远程连接

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM