Authentication error with .Net resource proxy

652
1
12-27-2019 01:01 AM
ApurvDanke
Occasional Contributor

Hello,

We have an application which is built using Web App Builder and it uses the ESRI resource proxy (.Net latest version 1.1.2) to access ArcGIS Online and other URL's accessible on internet.

The proxy application has been setup in IIS with anonymous authentication. 

Pinged the proxy and it worked fine.

https://[server]/[proxyname]/proxy.ashx?ping

Initially, I tried accessing ArcGIS Online URL via the proxy without making any changes in proxy config or application: https://[server]/[proxyname]/proxy.ashx?https://services.arcgisonline.com/ArcGIS/rest/services/World...

Got the following error.

{"error": {"code": 403,"message":"Proxy has not been set up for this URL. Make sure there is a serverUrl in the configuration file that matches: https://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer?f=json https://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer?f=json"}}

This means that the error message was coming from proxy application only as it mentioned “serverUrl” parameter. Now by default the following rule is already present in the default version of proxy.config

 

<serverUrl url="http://services.arcgisonline.com"

                   matchAll="true"/>

 

Still the above error message for “ServerUrl” came. So I added another “ServerUrl” as given below.

 

<serverUrl url="https://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer?f=json"

                   matchAll="true"/>

 

I didn’t mention any user or password or domain. Now I got the following error while trying to access AGOL URL via proxy.

 

{"error": {"code": 500,"message":"Unable to connect to the remote server https://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer?f=json"}}

 

This suggests that proxy application is unable to access internet. So now I changed the following line in proxy.ashx to use our organization proxy.

 

private static System.Net.IWebProxy SYSTEM_PROXY = new WebProxy("[Our organization proxy PAC file]",true); //System.Net.HttpWebRequest.DefaultWebProxy; // Use the default system proxy

After I did this change the AGOL URL was accessible via proxy.

However after some time when I tried to access same URL: 

https://[server]/[proxyname]/proxy.ashx?https://services.arcgisonline.com/ArcGIS/rest/services/World...

Getting this error (In Chrome)

This site can’t be reached

The webpage at https://[server]/[proxyname]/proxy.ashx?https://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer?f=json might be temporarily down or it may have moved permanently to a new web address.
ERR_UNEXPECTED_PROXY_AUTH

Error in IE

You must be authenticated by a proxy before the Web server can process your request.

Why is this happening?

Operating System is Windows Server 2016.

IIS version is 10.

ArcGIS Server, Portal for ArcGIS version is 10.7.1.

Regards,

Apurv

0 Kudos
1 Reply
Peter_Klingman
Esri Regular Contributor

Cross-posting this to ArcGIS API for JavaScript‌ and Developer Communities‌.

0 Kudos