I published and successfully accessed a GP service in ArcMap 10.2, but I couldn't make it work in my .NET program using ArcObjects 10.2:
IGeoProcessor gp = new GeoProcessorClass();
gp.AddToolbox(@"http://localhost:6080/arcgis/rest/services;mygpfolder/testsel");
//input
IGPUtilities2 gputils = new GPUtilitiesClass();
IFeatureClass fc = (IFeatureClass)gputils.OpenDatasetFromLocation(@"E:\input.shp");
IRecordSetInit recordset = new RecordSetClass();
recordset.SetSourceTable((ITable)fc, null);
IGPRecordSet gprecordset = new GPFeatureRecordSetLayerClass();
gprecordset.RecordSet = (IRecordSet)recordset;
IGPFeatureRecordSetLayer recordlayer = new GPFeatureRecordSetLayerClass();
recordlayer = gprecordset as IGPFeatureRecordSetLayer;
IVariantArray parameters = new VarArrayClass();
parameters.Add(recordlayer);
gp.Execute("Select", parameters, null);
I got "Error HRESULT E_FAIL has been returned from a call to a COM component." at "gp.Execute". The GP service is published using tool "Select" under toolbox "Analysis" in ArcMap:
Any suggestions?