Select to view content in your preferred language

No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost' is therefore not allowed access.

2233
3
03-06-2017 01:17 PM
JoseSanchez
Frequent Contributor

Hello everyone,

I am calling from javascript in a WebApp Application a rest web service using json,

var requestHandle = esriRequest({

"url": url,

"handleAs": "json",

}, {

useProxy: true,

usePost: false,

disableIdentityLookup: true

});

// requestHandle.then(this.requestSucceeded, this.requestFailed);

requestHandle.then(

lang.hitch(this, function (response, io) {

....

and I am getting the following error message:

No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost' is therefore not allowed access.

this code was working until I upgrade the asp.net application from framework   .Net Framework 2  to .Net Framework 4

Thanks

3 Replies
RobertScheitlin__GISP
MVP Emeritus

Jose,

   I almost never use localhost because of these type situations. Use your machine name and make sure your machine name is setup in your proxy.

JoseSanchez
Frequent Contributor

Hi Robert,

I am using tau machine name, and the name of the proxy. this code ran in .Net framework 2.0 but after upgrading the project to .Net framework 4.0 I have 2 issues, the call to the rest web service does not work and visual store does not stop at the point on debug.

Thanks

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Jose,

   Hmm.. I can't really tell you what might be going wrong. I can tell you that I have several RESTful .net 4.0 web service that work fine for me so it is not just a .net 4.0 thing.

Do you have allowedReferers as * in your proxy.config?

0 Kudos