问题描述
如果 http OPTIONS 已经在 applicationhost.config 中配置为 [OPTIONS=false],那么在 web.conig 中配置 http [OPTIONS=true] 时我的网站会发生什么?
ApplicationHostFile => 添加了 http OPTIONS = false 我的网站级别 web.config => 添加 http OPTIONS = true
哪个优先? & 在启动我的网站时会遇到任何问题 [服务器错误]?
[例如: 如果在 applicationhost.config 中添加 http 响应标头,我们将收到错误消息,指出“不允许重复”。因此,当两个文件具有相同的标头时,我们会收到 requestfiltering http 动词的任何错误吗?]
解决方法
如果在 Applicatiohost.config 文件中配置了 HTTP 动词,例如,
<system.webServer>
<security>
<requestFiltering>
<verbs allowUnlisted="true" applyToWebDAV="true">
<add verb="OPTIONS" allowed="false" />
</verbs>
</requestFiltering>
</security>
</system.webServer>
这可以在我们的网站 web.config 部分中通过配置来覆盖,
<system.webServer>
<security>
<requestFiltering>
<verbs>
<remove verb="OPTIONS" />
<add verb="OPTIONS" allowed="false" />
</verbs>
</requestFiltering>
</security>
</system.webServer>