AnsweredAssumed Answered

problem with setting up proxy

Question asked by maiagomez on Apr 22, 2016
Latest reply on Apr 23, 2016 by rscheitlin

I just want to load a map service using proxy. I read all of instructions for setting up proxy and proxy set up problems that are asked but I could not solve my problem.

 

I did following steps:

 

1- I downloaded the proxy files for .Net. They are proxy.ashx and proxy.config that I put them in a folder named proxy on

my server under inetpub/wwwroot.

 

2- I edited proxy.config file to contain the paths to my local services.

<?xml version="1.0" encoding="utf-8" ?>

<ProxyConfig allowedReferers="*"

             mustMatch="true">

    <serverUrls>

        <serverUrl url="http://localhost:6080.com"

                   matchAll="true"/>

    </serverUrls>

</ProxyConfig>

 

First question: I changed url="http://services.arcgisonline.com" to url="http://localhost:6080.com". is it right?

 

3- I went into IIS Manager and create an application from proxy folder.

 

My index html code in inetpub/wwwroot:

 

<!DOCTYPE html>

<html>

  <head>   

    <link rel="stylesheet" href="arcgis_js_api/library/3.14/3.14/esri/css/esri.css">

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">    

    <meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no">

    <title>Create Map and add a dynamic layer</title>

 

    <style>

      html, body, #mapDiv{

        padding: 0;

        margin: 0;

        height: 100%;

      }

    </style>

    <script src="arcgis_js_api/library/3.14/3.14/init.js"></script>

    <script>

      var map;

 

      require([

        "esri/map",

        "esri/config",

        "esri/layers/ArcGISDynamicMapServiceLayer",

        "esri/geometry/Extent",

        "esri/layers/ImageParameters",

       

      ], function (

        Map,esriConfig, ArcGISDynamicMapServiceLayer,Extent, ImageParameters) {      

    

        esriConfig.defaults.io.proxyUrl = "./proxy/proxy.ashx";

        esriConfig.defaults.io.alwaysUseProxy = true;     

       

        var bounds = new Extent({

        "xmin":817962,

        "ymin":-187036,

        "xmax":1566109,

        "ymax":785554,

        "spatialReference":{"wkid":32640}

          });

         

        map = new Map("mapDiv", {

          extent: bounds

        });        

       

        var dynamicMapServiceLayer = new ArcGISDynamicMapServiceLayer("http://localhost:6080/arcgis/rest/services    /sdeMXD/MapServer", {

          "opacity" : 0.5    

        });

 

        map.addLayer(dynamicMapServiceLayer);

      });

    </script>

  </head>

<body>   

   <div id="mapDiv"></div>

</body>

</html>

 

This is the error in firebug:

 

GET http://localhost:6080/arcgis/rest/info?f=json

200 OK

                                                              51ms

init.js (line 152)

 

SyntaxError: expected expression, got '<'                                                                                         proxy.a...allback (line 1)
<%@ WebHandler Language="C#" class="proxy" %> 

                                                                                                                                                            

dojo.io.script error RequestTimeoutError: Timeout exceeded { message="Timeout exceeded", stack=".cache["dojo/errors/crea...4/3.14/init.js:204:284\n", response={...}, more...}

                                                                                                                                                                       init.js (line 1488)

 

 

I spend long time but i could not find out what is wrong with it. I really appreciate it if anybody help me.Thanks in advance

Maria Gomez

Attachments

Outcomes