Please follow the below steps to enable Access-Control-Allow-Origin in IIS 8 for web API calls.
1. Open Internet Information Service (IIS) Manager.
2. Select the website you require and click on HTTP Response Headers.
3. Click on Add button on the Actions pane.
4. Enter the below details in Custom HTTP Response Headers.
- Enter Access-Control-Allow-Origin as the header name.
- Enter * as the header value.
5. Hit the OK button.
6. Now, you will have to add the following code to your web.config file.
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<httpProtocol>
<customHeaders>
<add name="Access-Control-Allow-Origin" value="*" />
</customHeaders>
</httpProtocol>
</system.webServer>
</configuration>