I wrote a desktop extension for ArcMap that allows a user to publish the map they've just created to an AGS 9.3.1 machine on another server. This works fine as long as the AGS machine acts as a SOM and a SOC. It also works if there are multiple other SOC machines in addition to the AGS machine.
However, if I go into the web manager on the AGS machine (let's call it serverA), and remove it as a host machine and specify serverB as a host/SOC machine, then the code fails when it tries to connect to the AGS instance on serverA. It says that it can't find the machine. Here is the code I'm using to connect and publish the MXD:
IServerObjectAdmin soa; ESRI.ArcGIS.Server.IGISServerConnection connection = new ESRI.ArcGIS.Server.GISServerConnection(); connection.Connect(server); soa = connection.ServerObjectAdmin; IServerObjectConfiguration3 soc = (IServerObjectConfiguration3)soa.CreateConfiguration(); soc.Name = psoObject.Title; soc.Description = psoObject.Description; soc.StartupType = esriStartupType.esriSTAutomatic; soc.TypeName = "MapServer"; soc.IsPooled = true; IPropertySet props = psoObject.AGSConfigPropertySet(soc); soc.Properties = props; soc.MinInstances = Convert.ToInt32(props.GetProperty("MinInstances").ToString()); soc.MaxInstances = Convert.ToInt32(props.GetProperty("MaxInstances").ToString()); soa.AddConfiguration(soc); soa.StartConfiguration(soc.Name, soc.TypeName); IServerMachine machine = soa.GetMachine(server); soa.UpdateMachine(machine);