1

I have an error in line which calling SubmitAndPollStatusAsync(parameter) Function

    public async void DisplayGrid()
    {
        try
        {
            Uri GridUri = new Uri("http://rsarcgis.eastus.cloudapp.azure.com/arcgis/rest/services/Geoprocessing/GenerateGrid/GPServer/GenerateMapGrid");

            _gpTask = new Geoprocessor(GridUri);

            var parameter = new GPInputParameter();
    parameter.GPParameters.Add(new GPLinearUnit("Width", LinearUnits.Miles, Width));
            parameter.GPParameters.Add(new GPLinearUnit("Height", LinearUnits.Miles, Height));
            parameter.GPParameters.Add(new GPLong("Rows_Count", RowsCount));
            parameter.GPParameters.Add(new GPLong("Columns_Count", ColumnsCount));
            parameter.GPParameters.Add(new GPString("Origin_Coordinate", CoordinateX+" "+CoordinateY.ToString()));


            parameter.OutSpatialReference = Globals.AppMainMapView.SpatialReference;
            parameter.ProcessSpatialReference = Globals.AppMainMapView.SpatialReference;
            var result = await SubmitAndPollStatusAsync(parameter);
            if (result.JobStatus == GPJobStatus.Succeeded)
            {


                var resultData = await _gpTask.GetResultDataAsync(result.JobID, "Clipped_Counties");
                if (resultData is GPFeatureRecordSetLayer)
                {
                    GPFeatureRecordSetLayer gpLayer = resultData as GPFeatureRecordSetLayer;
                    if (gpLayer.FeatureSet.Features.Count == 0)
                    {
                        var resultImageLayer = await _gpTask.GetResultImageLayerAsync(result.JobID, "Clipped_Counties");

                    }
                }
            }
        }
        catch (Esri.ArcGISRuntime.Http.ArcGISWebException exp)
        {
            Messenger.Default.Send(exp);
        }
    }

Code of SubmitAndPollStatusAsync( ) Function is :

      private async Task<GPJobInfo> SubmitAndPollStatusAsync(GPInputParameter parameter)
    {
        // Submit gp service job
        var result = await _gpTask.SubmitJobAsync(parameter);

        // Poll for the results async
        while (result.JobStatus != GPJobStatus.Cancelled && result.JobStatus != GPJobStatus.Deleted
            && result.JobStatus != GPJobStatus.Succeeded && result.JobStatus != GPJobStatus.TimedOut)
        {
            result = await _gpTask.CheckJobStatusAsync(result.JobID);

           // txtStatus.Text = string.Join(Environment.NewLine, result.Messages.Select(x => x.Description));

            await Task.Delay(2000);
        }

        return result;
    }
  • 1
    The best way to figure out a 500 error is to look at the actual HTTP traffic (which you haven't included) and manipulate it in a browser until is works, then change the code to generate working HTTP. – Vince Sep 18 '16 at 10:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.