Proxy page error using editor widgit?

3813
6
Jump to solution
04-09-2012 10:28 AM
JayGregory
New Contributor III
I am getting an error when I try to use the default editor widgit, and I think it might have to do with the proxy page...
I'm working on a dev server, and I essentially copied the code from this Esri sample and modified the links to my feature service and geometry service. 
When testing, I was at first getting a console error (I'm using firebug) of
"esri.config/defaults.io.proxyUrl is not set"
  So I followed the instructions to create a proxy for .NET server (I'm using IIS 7 so had to fill in the gaps since the documentation is for IIS 5 & 6).  The only snafu I ran into was when I was configuring/adding the proxy application is IIS, the test settings would fail using  "Application User (pass through authentication)".  So I clicked the "connect as" button and connected using a specific user, the ArcGISSOC account, and the "Test Settings" worked.  I modified the proxy.config file to include
<serverUrl url="http://win-2rninrlf7l8/ArcGIS/rest/services/WebMap/FeatureServer/ "matchAll="true"></serverUrl> 
and added
esri.config.defaults.io.proxyUrl = "/proxy/proxy.ashx";
to my page (the 2 proxy files are in C:\inetpub\wwwroot\proxy).
My page loads fine, but when I click on the default editor template and then click on the map to add a point, I get the following console error via Firebug:
"Error: [Exception... "Access to restricted URI denied" code: "1012" nsresult: "0x805303f4 (NS_ERROR_DOM_BAD_URI)" location: "http://serverapi.arcgisonline.com/jsapi/arcgis/?v=2.8 Line: 14"]"
  If I replace the proxy URL in my code to some junk, I get the same error, so I'm thinking it has something to do with how I've configured my proxy page.  I've tried various combinations of proxyURL URI's but everything seems to return that error, except if I try to use the absolute path
esri.config.defaults.io.proxyUrl = "C:/inetpub/wwwroot/proxy/proxy.ashx";
in which case I get this error:
Error: Permission denied for <file://> to create wrapper for object of class UnnamedClass

Any assistance resolving this issue would be of great help.

Thanks!

Jay
0 Kudos
1 Solution

Accepted Solutions
ShreyasVakil
Occasional Contributor II
You can directly check whether you can reach your rest endpoint through your proxy :
http://localhost/proxy/proxy.ashx?http://<url of rest endpoint>

or else :

Go to your IIS Manager and check whether you have enabled Anonymous Authentication in your 'Authentication' . Also go to 'Directory Browsing' and in the right panel hit enable to directly browse files from the server. And check if you have access to your folders.
in your browser just go to: http://localhost/proxy/   and check if you can see the two files in your browser. This will confirm whether you are getting access to our directory.

View solution in original post

0 Kudos
6 Replies
ShreyasVakil
Occasional Contributor II
There are couple of things you can try,

1. Go to your IIS manager.
-On the left panel under Connections browse to the proxy folder.
- Right click on the proxy folder and hit "Convert to Application".

or you can try

2. In your code replace the URL of the proxy with your server name(see below),
-esri.config.defaults.io.proxyUrl = "http://<serverName>/proxy/proxy.ashx";

Test your proxy by directly going to your browser and accessing any public site through proxy,
like: http://<serverName>/proxy/proxy.ashx?http://www.msn.com
0 Kudos
JayGregory
New Contributor III
Thanks Shreyas,
I've made some progress, but your tip sent me down a whole other path of troubleshooting.  I can tell I'm closer though!
I am now getting a post error when I try to add a point - its sending the correct request, I just don't know why it's failing.  I thought I set all my permissions correctly, giving the SOC and SOM administrator rights on my dev machine....
 
POST http://localhost/proxy/proxy.ashx?http://win-2rn...t/services/MapService/FeatureServer/0/applyEdits
NetworkError: 403 Forbidden -  http://localhost/proxy/proxy.ashx?http://win-2rn...t/services/MapService/FeatureServer/0/applyEdits
Error: Unable to load http://localhost/proxy/proxy.ashx?http://win-2rninrlf7l8/ArcGIS/rest/services/MapService/FeatureServ... status:403

Any ideas here?

Thanks!

Jay
0 Kudos
ShreyasVakil
Occasional Contributor II
You can directly check whether you can reach your rest endpoint through your proxy :
http://localhost/proxy/proxy.ashx?http://<url of rest endpoint>

or else :

Go to your IIS Manager and check whether you have enabled Anonymous Authentication in your 'Authentication' . Also go to 'Directory Browsing' and in the right panel hit enable to directly browse files from the server. And check if you have access to your folders.
in your browser just go to: http://localhost/proxy/   and check if you can see the two files in your browser. This will confirm whether you are getting access to our directory.
0 Kudos
JayGregory
New Contributor III
Thanks for your help -
I was able to get things to work nicely by changing the mustMatch parameter at the top of the config file to "false" instead of "true."
Jay
0 Kudos
filipebrandão
New Contributor
Hi JayGregory
Can you please explain what you mean by "I've made some progress, but your tip sent me down a whole other path of troubleshooting. I can tell I'm closer though! "
I'm exactly in the same boat as you apparently were, and so far all i get are those two errors you had depending on the path to the proxy.ashx file.
Did you do anything else besides changing the mustMatch from true to false?
Its just that I've tried that already and nothing...

Thanks in advance,

Filipe
0 Kudos
JayGregory
New Contributor III
So I believe the solution for me was due to the difference between testing operations my own local (development) copy of the website, and the copy on server.  As it turns out, I was only able to successfully use the proxy by actually loading my website onto the webserver, and accessing the the website through its url (e.g. http://www.mydomain.com/website/index.html).  In my code, simply using the relative-to-wwwroot proxy folder worked in the js (esri.config.defaults.io.proxyUrl = "/proxy/proxy.ashx"; when my proxy folder was a child of wwwroot. 

This would NOT work however if I was testing the website on my local computer.  I had to load it onto the web server and run it from there.  Does that make sense?
0 Kudos