I've been able to create map and image services by creating, adding, and starting configurations through an IServerObjectAdmin interface to a version 10.0 (sp4) ArcGIS server. Now, I'm shifting my focus to publishing toolboxes as GPServer configurations. I'm referring to the existing cfg file (found here ArcGIS\Server10.0\server\user\cfg) and setting properties exactly as found in this file. Regardless, when I try to add the configuration, I get an RPC failure exception and the SOM service on the targeted server has crashed. I'll include some stripped-down sample code to show how I'm going about adding configurations. I'd appreciate any ideas on how I could better go about publishing a geoprocessing toolbox. The underlying goal is to quickly replicate services from a failing (or failed) ArcGIS server onto another server to decrease downtime.
ESRI.ArcGIS.RuntimeManager.Bind(ESRI.ArcGIS.ProductCode.Desktop);
IGISServerConnection gisServerConnection = new GISServerConnection();
gisServerConnection.Connect(ServerName);
_serverObjectAdmin = gisServerConnection.ServerObjectAdmin;
var config = _serverObjectAdmin.CreateConfiguration();
// set config settings and other properties here
var config2 = (IServerObjectConfiguration2)config;
// set other settings accessible via Configuration2 interface
_serverObjectAdmin.AddConfiguration(config2);
_serverObjectAdmin.StartConfiguration("folder/service", "GPServer");