Problems uploading file to GeoProcessing Service (Could not access any GIS Server machines.)

04-13-2017 06:46 AM
New Contributor III

I'm trying to upload a file to a geoprocessing service that's hosted on an ArcGIS server which is federated in a Portal and behind a WebAdaptor.

This is the code I'm using (this is being used in a Xamarin Forms app):

var uploadUrl = "https://<myserver>/arcgisweb/rest/services/<mygp>/GPServer/uploads/upload";
using (var client = await ClientFactory.GetClient()) // client with correct authentication, logging, etc.
using (var content = new MultipartFormDataContent("Upload------123456"))
    content.Headers.ContentType = new MediaTypeHeaderValue("multipart/form-data");
    content.Add(new ByteArrayContent(File.ReadAllBytes(uploadPath)), "upload", DateTime.Now.ToString("yyyy-MM-dd_HH_mm_ss") + ".jpg");
    using (var msg = await client.PostAsync(new Uri(uploadUrl), content))
        var result = await msg.Content.ReadAsStringAsync();
        logger.Info("upload-result: " + result);

No matter what I'm doing, I always get the error

Could not access any GIS Server machines. Please contact your system administrator.

Using the browser on my device, I'm able to upload a file just fine (using the REST interface). Using map services on the same ArcGIS server works, too.

Is there anything I'm missing here?

0 Kudos
0 Replies