Cors is enabled in the web api at global level and is working fine locally, i am able to call it from any origin
but after hosting it on IIS 7.5 for testing , the cors policy again started poping up.
- public static void Register(HttpConfiguration config)
- {
- // Web API configuration and services
- // Web API routes
- config.MapHttpAttributeRoutes();
- EnableCorsAttribute cors = new EnableCorsAttribute("*", "*", "*");
- config.EnableCors(cors);
- config.Routes.MapHttpRoute(
- name: "DefaultApi",
- routeTemplate: "api/{controller}/{id}",
- defaults: new { id = RouteParameter.Optional }
- );
- }

Sachin SinghPosted Aug 17, 2020, 12:46 AM