Asp.Net WebApi2 Enable CORS not working with AspNet.WebApi.Cors 5.2.3

后端 未结 11 579
庸人自扰
庸人自扰 2020-11-27 11:06

I tried to follow the steps at http://enable-cors.org/server_aspnet.html to have my RESTful API (implemented with ASP.NET WebAPI2) work with cross origin requests (CORS Enab

11条回答
  •  广开言路
    2020-11-27 11:40

    After some modifications in my Web.config CORS suddenly stopped working in my Web API 2 project (at least for OPTIONS request during the preflight). It seems that you need to have the section mentioned below in your Web.config or otherwise the (global) EnableCorsAttribute will not work on OPTIONS requests. Note that this is the exact same section Visual Studio will add in a new Web API 2 project.

    
      
        
        
        
        
      
    
    

提交回复
热议问题