Trouble deploying ArcGIS Web App Builder application on my own server

7341
2
05-20-2015 10:10 AM
MatthewCarey
Occasional Contributor

Having trouble deploying a web mapping application that I've authored using ArcGIS Web App Builder.

I'm deploying it on a server that's accessible inside my organization only. It serves up a *secured* web map from our ArcGIS

Online organization. (I wish all the data could just be hosted in ArcGIS Server but the Web App Builder seems to be only

geared to serving up a Web Map from AGOL).

I authored the app using Web App Builder running on my own PC, then downloaded the files and placed them on my org's server in

C:\inetpub\wwwroot.

Following the readme document, I'm using the .NET proxy that I downloaded a while ago from github which seems to work fine in

other circumstances such as serving up a secured feature layer from AGOL in a locally-hosted Javascript API web app.

I modified my application's config.json file as follows:

"httpProxy":{"useProxy":true,"alwaysUseProxy":false,"url":"http://<mylocalserver>/proxy/proxy.ashx","rules":[{"urlPrefix":

"<myorg>.maps.arcgis.com/","proxyUrl": "http://<mylocalserver>/proxy/proxy.ashx"}]}

Then I added the locally hosted app in our AGOL portal, using the URL http://<mylocalserver's full name inc. domain>/<the app

name>

Then I registered it so that it has an App Id and an App Secret. I was stumped on what to enter for Redirect URI's so I tried

a bunch: http://<mylocalserver>:8000, http://<myorg>.maps.arcgis.com, https://<myorg>.maps.arcgis.com, and just for fun the

url of the oath-callback.html file that resides within the application on the local server.

I copied and pasted the AppID into the app's config.json file.

Also in my proxy.config file, I have this, which worked for me in the other context but admittedly is not in the application deployment instructions (b/c otherwise how does AGOL establish the credentials of the locally-hosted application when it wants access to the data?)

serverUrl url="http://<myorg>.maps.arcgis.com" clientId="<the App ID>" clientSecret="<the app Secret"> matchAll="true"

rateLimit="600" rateLimitPeriod="60"/>

serverUrl url="https://<myorg>.maps.arcgis.com" clientId="<the App ID>" clientSecret="<the app Secret"> matchAll="true"

rateLimit="600" rateLimitPeriod="60"/>

Now, finally, when I try to view the app in Chrome at: http://<mylocalserver>/<the app name>/  I get the blue background from

the web mapping app and a progress bar that goes up, but then I get "This webpage is not available" and

"ERR_CONNECTION_REFUSED", and the URL changes to https://<mylocalserver>/<the app name>/

The Chrome developer tools don't tell me much, but there's something in the proxy log file on the server which seems to be the

source of at least one the problems:

******************************************************************

w3wp.exe Information: 0 : 2015-05-20 12:34:56 https://<myorg>.maps.arcgis.com/sharing/portals/self?

f=json&dojo.preventCache=1432139695935&callback=dojo.io.script.jsonp_dojoIoScript1._jsonpCallback

w3wp.exe Information: 0 : 2015-05-20 12:34:56 Matching credentials found in configuration file. OAuth 2.0 mode: True

w3wp.exe Information: 0 : 2015-05-20 12:34:56 Service is secured by https://www.arcgis.com/sharing/oauth2/: getting new

  1. token...

w3wp.exe Information: 0 : 2015-05-20 12:34:56  Token obtained: Yj4mRmei1CTLD<I'm shortening this!

>xzlVLaI9IVdMWUk4pVlC17krnIWmuEN3WZNL-4w..

w3wp.exe Information: 0 : 2015-05-20 12:34:56  Exchanging Portal token for Server-specific token for

https://<myorg>.maps.arcgis.com...

w3wp.exe Error: 0 : 2015-05-20 12:34:56  Token cannot be obtained: {"error":{"code":400,"message":"Unable to generate

token","details":["Unable to generate token for this server"]}}

************************************************************************************

Something very similar to this repeats 5 more times.

Any thoughts/pointers on this please? Can't help thinking the Redirect URI's or confusion between http:// and https:// might be the

culprit but it could be something fundamental that I'm just not getting.

Thx!

0 Kudos
2 Replies
AlexMahrou
Occasional Contributor

What's the proper configuration for proxy.config and config.json for a self-hosted Web AppBuilder fo...

The above post will provide a solution for the proper configuration.

matthewpater
New Contributor II

This sounds familiar to something we had been dealing with also, although not exactly, but you are on the right track with the HTTP vs HTTPS issues. This was what we had to change in order to get everything working together nicely.

What we learned was that our AGOL account or portal is setup in HTTPS. So in order for any of our published mapservices or feature services to work in AGOL; we had to migrate our server side to HTTPS as well. We initiated our ArcServer with just HTTP, as we thought we were secure enough behind the corporate firewall. AGOL and your Server both need to be the same to work together. We ended up creating a Local CA certificate rather than buying one from VeriSign. All of our services are behind our corporate firewall which is "secure" but we still needed to migrate all of our mapservices to HTTPS to get anything working in AGOL and the AppBuilder. We were finally able to make and release App's after that migration. We are using the ArcGIS Viewer for Silverlight - Application Builder.

Try different browsers as well.

We noticed more issues with chrome, so we have been testing in FireFox.

What version of ArcServer you are running?

Hope this helps.