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:
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?