C# 远程处理对象和远程连接
我正在使用.NET远程处理来实现一些简单的基于观察者的IPC。我有两个问题:C# 远程处理对象和远程连接,c#,remoting,C#,Remoting,我正在使用.NET远程处理来实现一些简单的基于观察者的IPC。我有两个问题: 如果我在几分钟内没有从客户端对远程对象进行任何调用,那么当我尝试调用时会抛出一个错误,指定连接已断开。我怎样才能让它活着 我似乎无法通过TCP接受来自其他计算机的客户端。我正在使用一个配置如下的TCP通道: BinaryServerFormatterSinkProvider serverProv = new BinaryServerFormatterSinkProvider(); serverProv.Typ
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”)
,它总是超时。我不在防火墙后面,我的端口被正确转发。我可以将此端口用于基于套接字的应用程序,但由于某些原因,无法用于远程处理。请帮忙
请注意,对IP使用localhost可以很好地工作。它只是从一台远程计算机上连接,这会造成混乱。