100分求Remoting问题
我的Remoting服务器端是通过Windows服务实现的,服务器端配置文件为
<configuration>
<system.runtime.remoting>
<application name="RemoteHostService">
<service>
<wellknown type="RemoteObject.ZZCMaintenance, RemoteObject"
objectUri="RemoteObject.ZZCMaintenance" mode="Singleton" />
</service>
<channels>
<channel ref="tcp" port="8085">
<serverProviders>
<formatter ref="binary" />
</serverProviders>
</channel>
</channels>
</application>
</system.runtime.remoting>
</configuration>
然后在我们局域网上部署,应用客户端代码:
TcpChannel chan = new TcpChannel();
ChannelServices.RegisterChannel(chan);
objRemote = (RemoteObject.ZZCMaintenance)Activator.GetObject(typeof(RemoteObject.ZZCMaintenance),"tcp://192.168.1.152:8085/RemoteObject.ZZCMaintenance");
应用成功,没有任何问题,但是当我把windows服务部署到internet上,同时把客户端代码改为:
TcpChannel chan = new TcpChannel();
ChannelServices.RegisterChannel(chan);
objRemote = (RemoteObject.ZZCMaintenance)Activator.GetObject(typeof(RemoteObject.ZZCMaintenance),"tcp://xxx.xxx.xxx.xxx:8085/RemoteObject.ZZCMaintenance");
,调用出现如下错误:
未处理的“System.Net.Sockets.SocketException”类型的异常出现在 mscorlib.dll 中。
其他信息: 由于连接方在一段时间后没有正确答复或连接的主机没有反应,连接尝试失败。
是socket超时吗?怎么解决?在线等待,解决立马给分。