2

My Windows Web API Service is running on Linux (Nginx http server) with FastCGI Mono server.

When my clients try to invoke my web api service's methods, they see the following error message in response:

Cross-Origin Request Blocked: The Same Policy disallows reading the remote resource at http://localhost:5757/Service.asmx/HeartBeat?. This can be fixed by moving the resource to the same domain or enabling CORS.

My Nginx virtual host config file:

server {
     listen   5757;
     server_name  localhost;
     root /var/www/webservices/myservice;
     access_log   /var/log/nginx/myservice.access.log;

     location / {
             index index.html index.htm default.aspx Default.aspx;
             fastcgi_index Default.aspx;
             fastcgi_pass 127.0.0.1:9002;
             include /etc/nginx/fastcgi_params;
     }
}

I am confused how to overcome this problem???

Because on my localhost I tested all the methods and all of them work pretty well.

How to enable CORS and what steps should I take, if this is the cause? Because I am working with Nginx only for 2 weeks.

UPDATE:

This is my service's address:

http://217.11.176.115:5757/Service.asmx

If you open it with Firefox and invoke the HeartBeat method, you can see the error message with Firebug.

4

0 回答 0