【发布时间】:2021-12-28 20:02:58
【问题描述】:
目前在 ASP.NET Core MVC 应用程序中,我将以下 web.config 添加到站点:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<cors enabled="true">
<add origin="*" />
</cors>
</system.webServer>
</configuration>
但我收到一些客户需要将我的 cors 标签替换为以下内容的反馈:
<httpProtocol>
<customHeaders>
<add name="Access-Control-Allow-Origin" value="*" />
</customHeaders>
</httpProtocol>
我想知道它们在功能上有何不同?在我看来,它们会产生相同的结果,但在实践中似乎并非如此。
编辑:我确实想知道问题是否是其中一些服务器缺少 IIS Cors 模块。阅读MSDN Documentation for the cors tag 似乎等同于每个编写的第二个选项。
【问题讨论】:
标签: asp.net-mvc iis cors web-config