Quantcast
Channel: Web API
Viewing all articles
Browse latest Browse all 4850

Web API 2 web service using CORS works in IIS Express, but not when deployed to IIS 7.5.

$
0
0

I can access my Web API 2 service when I run it from VS 2013 (localhost:22532) and I have tested that CORS is working by adding/removing the [EnableCors(origins:"http://localhost:11705", headers: "*", methods: "*"] and running it in a Chrome browser using "http://localhost:11705". It responds as expected.

But when I deploy it to IIS 7.5 (http://localhost:8020), I continually get:

XMLHttpRequest cannot load http://localhost:8020/api/DataService/GetNavigationLocationInfo?userId=24&roleId=9. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:11705' is therefore not allowed access.

Is there some setup issue I am missing on IIS 7.5?

Headers:

  1. Request URL: http://localhost:8020/api/DataService/GetNavigationLocationInfo?userId=24&roleId=9</div>
  2. Request Headers CAUTION: Provisional headers are shown.
    1. Accept: application/json, text/javascript, */*; q=0.01
    2. Origin: http://localhost:11705
    3. Referer: http://localhost:11705/
    4. User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.146 Safari/537.36
  3. Query String Parameters
    1. userId: 24
    2. roleId: 9

There is no response showing in debug window.


Viewing all articles
Browse latest Browse all 4850

Trending Articles