How to enable CORS in ASP.NET Core

前端 未结 12 787
无人及你
无人及你 2020-11-22 14:11

I am trying to enable cross origin resources sharing on my ASP.NET Core Web API, but I am stuck.

The EnableCors attribute accepts policyName

12条回答
  •  不要未来只要你来
    2020-11-22 14:27

    In case you get the error "No 'Access-Control-Allow-Origin' header is present on the requested resource." Specifically for PUT and DELETE requests, you could try to disable WebDAV on IIS.

    Apparently, the WebDAVModule is enabled by default and is disabling PUT and DELETE requests by default.

    To disable the WebDAVModule, add this to your web.config:

    
      
        
      
    
    

提交回复
热议问题