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 <SPAN class="operator token">=</SPAN> <SPAN class="keyword token">await</SPAN> GeoprocessingTask<SPAN class="punctuation token">.</SPAN><SPAN class="token function">CreateAsync</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="keyword token">new</SPAN> <SPAN class="token class-name">Uri</SPAN><SPAN class="punctuation token">(</SPAN>baseurl <SPAN class="operator token">+</SPAN> <SPAN class="string token">@"/arcgis/rest/services/tasks/GPServer/FindHotSpots"</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
GeoprocessingParameters hotspotParams <SPAN class="operator token">=</SPAN> <SPAN class="keyword token">new</SPAN> <SPAN class="token class-name">GeoprocessingParameters</SPAN><SPAN class="punctuation token">(</SPAN>GeoprocessingExecutionType<SPAN class="punctuation token">.</SPAN>AsynchronousSubmit<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
hotspotParams<SPAN class="punctuation token">.</SPAN>Inputs<SPAN class="punctuation token">.</SPAN><SPAN class="token function">Add</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="string token">"analysisLayer"</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="keyword token">new</SPAN> <SPAN class="token class-name">GeoprocessingFeatures</SPAN><SPAN class="punctuation token">(</SPAN>featureCollectionTable<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
hotspotParams<SPAN class="punctuation token">.</SPAN>Inputs<SPAN class="punctuation token">.</SPAN><SPAN class="token function">Add</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="string token">"shapeType"</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="keyword token">new</SPAN> <SPAN class="token class-name">GeoprocessingString</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="string token">"fishnet"</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
GeoprocessingJob hotspotJob <SPAN class="operator token">=</SPAN> hotspotTask<SPAN class="punctuation token">.</SPAN><SPAN class="token function">CreateJob</SPAN><SPAN class="punctuation token">(</SPAN>hotspotParams<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">try</SPAN>
<SPAN class="punctuation token">{</SPAN>
GeoprocessingResult hotspotResult <SPAN class="operator token">=</SPAN> <SPAN class="keyword token">await</SPAN> hotspotJob<SPAN class="punctuation token">.</SPAN><SPAN class="token function">GetResultAsync</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="punctuation token">}</SPAN>
<SPAN class="keyword token">catch</SPAN> <SPAN class="punctuation token">(</SPAN><SPAN class="token class-name">TaskCanceledException</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="punctuation token">{</SPAN>
<SPAN class="comment token">//Ignore</SPAN>
<SPAN class="punctuation token">}</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
Any help would be appreciated.
Thanks,
Keith