The internet generally can be found through the Microsoft.AspNet.WebApi.Cors to achieve cors, which is through the DLL way, and then there is a way through the Config
1, DLL way to achieve cors
The advantage of this way is to control the fine, you can assign different cors settings to the action under the same site, specifically how to implement here is not much to say, do not know can see http://www.cnblogs.com/artech/p/ Cors-4-asp-net-web-api-05.html
And then here's a note of what's actually going to happen.
A) System.Web.Http failed to load
This can be downloaded directly to the DLL and then added to the project reference
b) Attempt to access security-critical types
This is because the System.Web.Http version is inconsistent, I do the test Microsoft.AspNet.WebApi.Cors version is 5.2.3, and the default is to add a System.Web.Http of 4.0, re-download the matching version through NuGet, and then adjust the reference to 5.2.3 version of the reference can fix the problem
<package id= "Microsoft.AspNet.WebApi.WebHost" version= "5.2.3" targetframework= "Net45"/>
c) error caused by default appsetting configuration
Http://diaosbook.com/Post/2013/12/27/tips-for-aspnet-webapi-cors ( Note that the Vs2013 for personal testing did not encounter this problem)
2. config method to achieve cors
The benefit of adding configuration under the System.webserver configuration section of the Web. config is simple, as long as this configuration is added here, all APIs can support cross-domain requests by the same rule
WebAPI CORS supports cross-domain post