Hello all,
I am using a GeoprocessingTask in my .NET application to do find hot spots on some point features. I give the GeoprocessingTask the url to the server ending with /GPServer/FindHotSpots and I create GeoprocessingParameters where I specify the input parameters for the analysisLayer and shapeType. I set the analysisLayer to a featureCollectionTable with my features that I want to use. Then, I create the GeoprocessingJob and await the result. It ends up throwing an exception with the error code 405. I inspected the traffic with Fiddler and I saw that after the jobStatus was esriJobStatusSucceeded, it got the hotSpotsResultLayer (<serverUrl>/arcgis/rest/services/GPServer/FindHotSpots/jobs/<jobID>/results/hotSpotsResultLayer?<parameters>) and the processInfo (<serverUrl>/arcgis/rest/services/GPServer/FindHotSpots/jobs/<jobID>/results/processInfo?<parameters>) successfully. However, after that, it sent a request to the url: <serverUrl>/arcgis/rest/services/GPServer?token=<token>. Something is causing it to send a request to the GPServer directly which is where the 405 error comes from.
Is this a problem with my code, or a problem with the GeoprocessingJob and the way it sends the requests behind the scenes? Either way, this Exception breaks out of the GetResultAsync method and I am not able to access the data from the server that is getting sent correctly.
Below is the code where I set up the GeoprocessingTask and a screenshot of fiddler which shows some of the requests/responses with the server.
GeoprocessingTask hotspotTask = await GeoprocessingTask.CreateAsync(new Uri(baseurl + @"/arcgis/rest/services/tasks/GPServer/FindHotSpots"));
GeoprocessingParameters hotspotParams = new GeoprocessingParameters(GeoprocessingExecutionType.AsynchronousSubmit);
hotspotParams.Inputs.Add("analysisLayer", new GeoprocessingFeatures(featureCollectionTable));
hotspotParams.Inputs.Add("shapeType", new GeoprocessingString("fishnet"));
GeoprocessingJob hotspotJob = hotspotTask.CreateJob(hotspotParams);
try
{
GeoprocessingResult hotspotResult = await hotspotJob.GetResultAsync();
}
catch (TaskCanceledException)
{
//Ignore
}
Any help would be appreciated.
Thanks,
Keith