1

I have spent a lot of time to solve a error in setting up proxy for JS API but I could not find any solution.

I did following steps:

  1. I downloaded the proxy files for .Net.
  2. I edited proxy.config file
  3. I created an application
  4. i tested proxy

when i run my codes it gives following error in chrome browser:

proxy.ashx?http://localhost:6080/arcgis/rest/services/sdeMXD/MapServer?f=json&dpi=96&transparent=tr…:1

Uncaught SyntaxError: Unexpected token <

in firebug it gives this error:

GET http://localhost:6080/arcgis/rest/info?f=json 200 OK 87ms/3.16/ (line152)

SyntaxError: expected expression, got '<' proxy.a...allback (line 1) dojo.io.script error RequestTimeoutError: Timeout exceeded { message="Timeout exceeded", stack=".cache["dojo/errors/crea...cgis.com/3.16/:204:284\n", response={...}, more...}

  • Do you have a stray "<" in your proxy.config file? – CCantey Apr 23 '16 at 14:42
  • this is my proxy.config file , does it need any edit? <?xml version="1.0" encoding="utf-8" ?> <ProxyConfig allowedReferers="*" mustMatch="true"> <serverUrls> <serverUrl url="localhost:6080" matchAll="true"/> </serverUrls> </ProxyConfig> – Maria Gomez Apr 23 '16 at 14:48
  • sorry it is too messy, i could not find out how to attach proxy.config file – Maria Gomez Apr 23 '16 at 15:01
  • So that error seems to be a generic error thrown when you are trying to access a service without a valid token, usually caused by bad URLs... as far as I can tell ... As an aside, it looks like you have a stray space in your esri.css link. That could be beefing you up - it breaks my apps – CCantey Apr 23 '16 at 18:39
  • the dynamicMapServiceLayer service works correctly when i do not use proxy and there is not any error but when i add proxy scripts ( esriConfig.defaults.io.proxyUrl = "proxy/proxy.ashx"; esriConfig.defaults.io.alwaysUseProxy = true;), the error appears. anybody can help me? – Maria Gomez Apr 23 '16 at 19:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.