CORS support for IIS8

Here are three articles that explain really well how to enable CORS in Web API 2. Brock Allen(Newest One) MSDN Blog ASP.NET Website
I was trying to figure configure this for IIS8, since I had it working in my local machine using IIS Express, but every time I deployed the code to the server, I kept getting Allow-Cross-Origin-Request error. I finally figure it out. Default SPA Template for Web API 2 in VS2013, for web.config we have

<handlers>  
    <remove name="OPTIONSVerbHandler"/>
</handlers>  

This will only work if you are deploying to the IIS 7.5 and below, but if your server has IIS 8, the handler name has changed from OPTIONSVerbHandler to just OPTIONS, so you will have to change it to.

<handlers>  
   <remove name="OPTIONS"/>
</handlers>  

Happy Coding!

comments powered by Disqus