如何更改IIS上的内容安全策略指令

如何更改IIS上的内容安全策略指令,iis,Iis,我正在服务器上运行一个WebApp,我想更改内容安全策略,以便为所有外部网站启用iFrame嵌入 目前我得到以下错误: ...in a frame because an ancestor violates the following Content Security Policy directive: "frame-ancestors 'self' 如何允许IIS服务器上的所有网站嵌入iFrame?根据您的描述,我建议您可以尝试在web.config中使用自定义标题。此设置将标记所有响应并添加

我正在服务器上运行一个WebApp,我想更改内容安全策略,以便为所有外部网站启用iFrame嵌入

目前我得到以下错误:

...in a frame because an ancestor violates the following Content Security Policy directive: "frame-ancestors 'self'

如何允许IIS服务器上的所有网站嵌入iFrame?

根据您的描述,我建议您可以尝试在web.config中使用自定义标题。此设置将标记所有响应并添加帧设置

<system.webServer>
        <httpProtocol>
            <customHeaders>
                <add name="Content-Security-Policy" value="default-src 'self';frame-ancestors my-trusty-site.com" />
            </customHeaders>
        </httpProtocol>
    </system.webServer>