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):
<SPAN class="keyword token">var</SPAN> uploadUrl <SPAN class="operator token">=</SPAN> <SPAN class="string token"><SPAN>"</SPAN><A class="jive-link-external-small" href="https://community.esri.com/external-link.jspa?url=https%3A%2F%2F" target="_blank">https://</A><SPAN><myserver>/arcgisweb/rest/services/<mygp>/GPServer/uploads/upload"</SPAN></SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">using</SPAN> <SPAN class="punctuation token">(</SPAN><SPAN class="keyword token">var</SPAN> client <SPAN class="operator token">=</SPAN> <SPAN class="keyword token">await</SPAN> ClientFactory<SPAN class="punctuation token">.</SPAN><SPAN class="token function">GetClient</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="comment token">// client with correct authentication, logging, etc.</SPAN>
<SPAN class="keyword token">using</SPAN> <SPAN class="punctuation token">(</SPAN><SPAN class="keyword token">var</SPAN> content <SPAN class="operator token">=</SPAN> <SPAN class="keyword token">new</SPAN> <SPAN class="token class-name">MultipartFormDataContent</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="string token">"Upload------123456"</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="punctuation token">{</SPAN>
content<SPAN class="punctuation token">.</SPAN>Headers<SPAN class="punctuation token">.</SPAN>ContentType <SPAN class="operator token">=</SPAN> <SPAN class="keyword token">new</SPAN> <SPAN class="token class-name">MediaTypeHeaderValue</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="string token">"multipart/form-data"</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
content<SPAN class="punctuation token">.</SPAN><SPAN class="token function">Add</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="keyword token">new</SPAN> <SPAN class="token class-name">ByteArrayContent</SPAN><SPAN class="punctuation token">(</SPAN>File<SPAN class="punctuation token">.</SPAN><SPAN class="token function">ReadAllBytes</SPAN><SPAN class="punctuation token">(</SPAN>uploadPath<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"upload"</SPAN><SPAN class="punctuation token">,</SPAN> DateTime<SPAN class="punctuation token">.</SPAN>Now<SPAN class="punctuation token">.</SPAN><SPAN class="token function">ToString</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="string token">"yyyy-MM-dd_HH_mm_ss"</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="operator token">+</SPAN> <SPAN class="string token">".jpg"</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">using</SPAN> <SPAN class="punctuation token">(</SPAN><SPAN class="keyword token">var</SPAN> msg <SPAN class="operator token">=</SPAN> <SPAN class="keyword token">await</SPAN> client<SPAN class="punctuation token">.</SPAN><SPAN class="token function">PostAsync</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="keyword token">new</SPAN> <SPAN class="token class-name">Uri</SPAN><SPAN class="punctuation token">(</SPAN>uploadUrl<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">,</SPAN> content<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="punctuation token">{</SPAN>
<SPAN class="keyword token">var</SPAN> result <SPAN class="operator token">=</SPAN> <SPAN class="keyword token">await</SPAN> msg<SPAN class="punctuation token">.</SPAN>Content<SPAN class="punctuation token">.</SPAN><SPAN class="token function">ReadAsStringAsync</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
logger<SPAN class="punctuation token">.</SPAN><SPAN class="token function">Info</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="string token">"upload-result: "</SPAN> <SPAN class="operator token">+</SPAN> result<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="punctuation token">}</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>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?