更新时间:2022-05-20 22:38:02
通常,我读到的线程会建议几个不必要的配置步骤,这会造成混乱.其实很简单……
Oftentimes, the threads that I read were suggesting several unecessary configuration steps, which created confusion. It's actually very simple...
出于将跨站点请求从 Angular 客户端发送到 ASP 控制器的简单目的:
For the simple purpose of sending a cross site request, from an angular client, to an ASP controller :
唯一的强制修改是在服务器的 web.config 中添加这个
The only mandatory modification is to add this in the server's web.config
<system.webServer>
<httpProtocol>
<customHeaders>
<clear />
<add name="Access-Control-Allow-Origin" value="*" />
<add name="Access-Control-Allow-Headers" value="Content-Type"/>
</customHeaders>
</httpProtocol>
</system.webServer>