.NET Remoting 连接到错误的主机
我编写了一个应用程序,该应用程序已经运行良好 4 年了。昨天,他们移动了所有服务器并安装了大约 60 个待处理的 Windows 更新,但现在它已经损坏了。该应用程序利用远程处理来更新另一台服务器(10.0.5.230)上的一些信息,但是当我尝试创建远程对象时,出现以下异常: 错误消息:无法建立连接,因为目标机器主动拒绝 127.0.0.1:9091 http://img692.imageshack.us/img692/8104/screenshot1ay.png
请注意,它正在尝试连接到 127.0.0.1,而不是正确的服务器。服务器 (10.0.5.230) 正在监听端口 9091。安装此应用程序的所有三个终端服务器上都会发生同样的错误。
这是注册远程对象的代码:
public static void RegisterClient()
{
string lServer;
RegistryKey lKey = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Shoreline Teleworks\\ShoreWare Client");
if (lKey == null)
throw new InvalidOperationException("Could not find Shoretel Call Manager");
object lVal = lKey.GetValue("Server");
if (lVal == null)
throw new InvalidOperationException("Shoretel Call Manager did not specify a server name");
lServer = lVal.ToString();
IDictionary props = new Hashtable();
props["port"] = 0;
string s = System.Guid.NewGuid().ToString();
props["name"] = s;
ChannelServices.RegisterChannel(new TcpClientChannel(props, null), false);
RemotingConfiguration.RegisterActivatedClientType(typeof(UpdateClient),
"tcp://" + lServer + ":" + S_REMOTING_PORT + "/");
RemotingConfiguration.RegisterActivatedClientType(typeof(Playback),
"tcp://" + lServer + ":" + S_REMOTING_PORT + "/");
}
这是调用远程对象的代码:
UpdateClient lUpdater = new UpdateClient(Settings.CurrentSettings.Extension.ToString());
lUpdater.SetAgentState(false);
我已验证以下 URI 已传递给 RegisterActivatedClientType:“tcp://10.0.5.230:9091/” 为什么此应用程序会尝试连接到错误的服务器?
其他信息:
客户端确实连接到服务器:它向服务器发送一条 ConstructionCall 消息并接收回一条 ConstructionResponse。此 ConstructionResponse 包含引用 URI tcp://127.0.0.1:9091 的 ObjRef。我无法弄清楚这个 URI 被分配到哪里。知道为什么服务器会返回这个吗?
I have an application I wrote which has been running well for 4 years. Yesterday they moved all their servers around and installed about 60 pending Windows updates, and now it is broken. The application makes use of remoting to update some information on another server (10.0.5.230), but when I try to create my remote object, I get the following exception:
Error message: No connection could be made because the target machine actively refused it 127.0.0.1:9091 http://img692.imageshack.us/img692/8104/screenshot1ay.png
Note that it is trying to connect to 127.0.0.1, not the proper server. The server (10.0.5.230) is listening on port 9091 as it should. This same error is happening on all three terminal servers where this application is installed.
Here is the code which registers the remoted object:
public static void RegisterClient()
{
string lServer;
RegistryKey lKey = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Shoreline Teleworks\\ShoreWare Client");
if (lKey == null)
throw new InvalidOperationException("Could not find Shoretel Call Manager");
object lVal = lKey.GetValue("Server");
if (lVal == null)
throw new InvalidOperationException("Shoretel Call Manager did not specify a server name");
lServer = lVal.ToString();
IDictionary props = new Hashtable();
props["port"] = 0;
string s = System.Guid.NewGuid().ToString();
props["name"] = s;
ChannelServices.RegisterChannel(new TcpClientChannel(props, null), false);
RemotingConfiguration.RegisterActivatedClientType(typeof(UpdateClient),
"tcp://" + lServer + ":" + S_REMOTING_PORT + "/");
RemotingConfiguration.RegisterActivatedClientType(typeof(Playback),
"tcp://" + lServer + ":" + S_REMOTING_PORT + "/");
}
Here is the code which calls the remoted object:
UpdateClient lUpdater = new UpdateClient(Settings.CurrentSettings.Extension.ToString());
lUpdater.SetAgentState(false);
I have verified that the following URI is passed to RegisterActivatedClientType: "tcp://10.0.5.230:9091/"
Why does this application try to connect to the wrong server?
Additional information:
The client does connect to the server: It sends a ConstructionCall message to the server and receives back a ConstructionResponse. This ConstructionResponse contains an ObjRef which references the URI tcp://127.0.0.1:9091. I can't figure out where this URI is being assigned. Any idea why the server would return this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我发现问题:远程服务器启用了两个网卡,其中一个未插入。禁用未使用的网卡解决了该问题。
I have found the problem: The remoting server had two network cards enabled, one of them unplugged. Disabling the unused network card resolved the issue.