I created simple simple web site:
require([
"esri/map",
"esri/config",
"esri/dijit/InfoWindowLite",
"esri/InfoTemplate",
"dojo/dom-construct",
"dojo/domReady!"
], function (
Map,
esriConfig,
InfoWindowLite,
InfoTemplate,
domConstruct
) {
esriConfig.defaults.io.proxyUrl = "http://111.111.111.111:6969/agsproxy/proxy.ashx"
esriConfig.defaults.io.alwaysUseProxy = true;
var customExtentAndSR = new esri.geometry.Extent(-437000, -1244500, -409000, -1239500, new esri.SpatialReference({ wkid: 5514 }));
map = new Map("mapDiv", { logo: false, extent: customExtentAndSR, nav: false, slider: false, fitExtent: true, fadeOnZoom: true, showAttribution: false });
var infoWindow = new InfoWindowLite(null, domConstruct.create("div", null, null, map.root));
infoWindow.startup();
map.setInfoWindow(infoWindow);
var template = new InfoTemplate();
var featureLayer = new esri.layers.FeatureLayer("http://111.111.111.111:6969/ags/rest/services/VSLP2014/jprl_plochy/MapServer/0", {
mode: esri.layers.FeatureLayer.MODE_SNAPSHOT,
infoTemplate: template,
outFields: ["*"]
});
map.addLayer(featureLayer);
});
When I use "MODE_SNAPSHOT" for my featurelayer, layer is displayed and is possible to display infotemplate. But when I run my web site again, It seems to be problem with CORS (No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:12345' is therefore not allowed access.). Once is everything OK, once not. When I run my web site 10 times, approximatelly 5 times is problem with CORS. When I use "MODE_ONDEMAND" it´s OK but when I zoom my layer, problem with CORS is displayed and zoomed layer is not displayed. When I used this sample code with the same layer but as dynamicservicelayer with labels, It seems to be OK. Could someone help me with this problem ? Is it problem with settings in proxy ?