Web Applicaton using data from a Google Fusion Table

3495
8
Jump to solution
04-08-2014 10:33 AM
DaleSimper
New Contributor III
I created an ArcGIS Online map using data from a csv hosted in Google Fusion Tables and then created a web application, everything works fine if it is hosted on arcgis.com. But if I download the web application and run it from my server the csv data does not come through and I get a esri.config.defaults.io.proxyUrl is not set error.  I have tried setting a proxy and following the information from the proxy page in the help, but just can't seem to get it to work. Any help I can get to allow the csv data to be shown in my web application will be much appreciated.
0 Kudos
1 Solution

Accepted Solutions
DaleSimper
New Contributor III
Finally got it to work by adding       
<add name="Access-Control-Allow-Headers" value="Origin, X-Requested-With, Content-Type, Accept" />
below <add name="Access-Control-Allow-Origin" value="*" /> in the web.config.

View solution in original post

0 Kudos
8 Replies
JonathanUihlein
Esri Regular Contributor
Hi Dale,

Which proxy did you end up using? (Java, PHP or .NET)

Were you able to confirm that the proxy is set up correctly?

Using the .NET proxy as an example, you can confirm your proxy is set up correctly by accessing the following URL:
http://[yourmachine]/DotNet/proxy.ashx?http://services.arcgisonline.com/ArcGIS/rest/services/?f=pjson

This information is included in the README that comes with each proxy.

Assuming this works, are there any error messages in the console?

Using the Proxy Doc:
https://developers.arcgis.com/javascript/jshelp/ags_proxy.html
0 Kudos
DaleSimper
New Contributor III
Jon,
I am using the .Net proxy and have confirmed that it is working using the example.  I have the proxyurl set in the javascript files. I am using the map gallery template and the basic viewer template. My ArcGIS Online map that I'm using for the apps is http://bit.ly/1kLDvHR
The map gallery still gives me error: Error: esri.config.defaults.io.proxyUrl is not set. utils.js:229.

The basic viewer app errors: 
GET http://myserver/DotNet/proxy.ashx?https://www.google.com/fusiontables/expo�?�om+1PncbNo8M_8uIamKiWR6... 403 (Forbidden) init.js:159

m {stack: "Error: Unable to load http://myserver/DotNet/prox�?�uest.f (http://js.arcgis.com/3.9/init.js:160:512)", message: "Unable to load http://myserver/DotNet/proxy.ashx?�?�foCdZE+where+col4+not+equal+to+%27%27 status: 403", response: Object, status: 403, responseText: "<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Stric�?�>
_ssl: undefined
log: undefined
message: "Unable to draw graphic (null): Unable to load http://myserver/DotNet/proxy.ashx?https://www.google.com/fusiontables/exporttable?query=select+*+fro... status: 403"
response: Object
responseText: "<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
�?�<html xmlns="http://www.w3.org/1999/xhtml">
�?�<head>
�?�<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
�?�<title>403 - Forbidden: Access is denied.</title>
0 Kudos
JonathanUihlein
Esri Regular Contributor
The error where it says "Forbidden: Access is denied" leads me to believe there is a path issue either in the Javascript or with your IIS config.

According to those error messages, your webserver is named "myserver"; is this correct?

What do you see if you go to http://localhost/ ? Is it the same as http://myserver/ ?

Do you see JSON on this page:

http://myserver/DotNet/proxy.ashx?http://services.arcgisonline.com/ArcGIS/rest/services/?f=pjson
0 Kudos
DaleSimper
New Contributor III
0 Kudos
DaleSimper
New Contributor III
Finally got it to work by adding       
<add name="Access-Control-Allow-Headers" value="Origin, X-Requested-With, Content-Type, Accept" />
below <add name="Access-Control-Allow-Origin" value="*" /> in the web.config.
0 Kudos
JonathanUihlein
Esri Regular Contributor
Great!

If you don't mind me asking, where did you find that piece of information?

I want to make a note of it in case anyone has a similar issue.
0 Kudos
DaleSimper
New Contributor III
Since web development is pretty new to me, it took me a lot of trial and error and searching the internet to get it to work.  And I was getting different results with the different templates.  Using an old Map Gallery Template I got it to work with just setting up the proxy.  But with the Basic Viewer Template I was getting this error,   Request header field X-Requested-With is not allowed by Access-Control-Allow-Headers.  So I searched and found info here  http://stackoverflow.com/questions/12409600/error-request-header-field-content-type-is-not-allowed-b..., about adding the Access-Control-Allow-Headers. 

I still cannot get the newest Map Gallery Template to work, using the same proxy and settings, I get the error saying the proxy isn't set.   error: Error: esri.config.defaults.io.proxyUrl is not set. utils.js:229
So I'm not sure if there is an error in the template code or if there is something else I need to do.
0 Kudos
RyanKoehnen
New Contributor III

For anybody having issues with CORS config on their IIS arcgis web adaptor, here's what I added to the web.config under wwwroot\arcgis-

I added the following under the <system.webServer> section-

<httpProtocol>

<customHeaders>

<!--<add name="Access-Control-Allow-Origin" value="*" />-->

  <add name="Access-Control-Allow-Methods" value="GET,PUT,POST,DELETE,OPTIONS" />

  <add name="Access-Control-Allow-Headers" value="Content-Type" />

  </customHeaders>

</httpProtocol>

The request header for Access-Control-Allow-Origin was already defined someplace, I could not figure out where, so that part I left commented out. Only needed everything below that.

0 Kudos