1 Nuget报名:Microsoft.AspNet.WebApi.Cors
2 使用如下
public class WebApiApplication : System.Web.HttpApplication { protected void Application_Start() { GlobalConfiguration.Configure(Register); } public static void Register(HttpConfiguration config) { config.EnableCors(); } }