spienaar-esri-southafrica-esridist

Wcf Service and ArcObjects Geoprocessing

Discussion created by spienaar-esri-southafrica-esridist on Feb 19, 2013
Latest reply on Feb 19, 2013 by spienaar-esri-southafrica-esridist
Okay. We had and ArcGIS 10 Add in. The Add in allowed the user to draw and area on the map. That specified area then gets exported to shp, dxf and zipped for the user. To do this we created a Wcf Service that checked out an ArcGIS Desktop License. The serivce was 32 bit, .NET FrameWork 3.5 and used some of the Analaysis tools and so on found in ArcToolbox and we coded this using ArcObjects. The reason for using an Wcf service was that we also had a silverlight Web application that used the same service to do the same thing.
This all worked very well. Now we wanted to upgrade the client to ArcGIS 10.1. Initiallly we just upgraded to ArcGIS 10.1, used the new dlls and upgraded the service to .NET FrameWork 4.0 and changed to license initialize to use an ArcGIS Desktop Advance License. The application compiles and I can make calls to the web service that include ArcObjects functionality with out problem unitil we get to and Geoprocessing.Excecute method. The web service fails every it gets called. The data is small and alll the web configurations have been set. As I say this all worked in ArcGIS 10. We tried changing the web service to a 64 bit application and checking out a ArcGIS Server license. This works but as soon as we get to a call that calls any GP.Execute it fails. Any other ArcObjects code creating featueres works fine in a method that then gets called via the wcf service except for GP.Execute. Also I tested the method by running it via a Console app instead of wrapping it around a method and it works fine. Help would be appreciated. Sample of a typical method call is:
  public string ClipLayer(string workingFolder, string clipShapeName,string featureClassName, string OutPutFeatureClassName)
  {
   try
   {
                IVariantArray parameters = new VarArrayClass();
                parameters.Add(workingFolder + "\\" + featureClassName);
                parameters.Add(workingFolder + "\\" + clipShapeName);
                parameters.Add(workingFolder + "\\" + OutPutFeatureClassName);
                _GP.OverwriteOutput = true;
                IGeoProcessorResult2 result = new GeoProcessorResultClass();
                result = _GP.Execute(@"Clip_analysis", parameters, null) as IGeoProcessorResult2;
    return _GP.GetMessage(0);
   }
   catch (Exception exp)
   {
    throw new Exception(exp.Message);
   }
  }

Outcomes