web.config响应头问题 [英] Issue with web.config response header
问题描述
我有一个web.config文件,其中包含以下部分
< system.webServer>
< httpProtocol>
< customHeaders>
< add name =Cache-Controlvalue =no-cache/>
< add name =Pragmavalue =no-cache/>
< add name =Expiresvalue = - 1/>
< add name =X-UA-Compatiblevalue =IE = Edge,chrome = 1/>
< / customHeaders>
< / httpProtocol>
< /system.webServer>
当在IIS中访问网站时,它会出现此错误:无法添加add类型的重复集合条目,其中唯一键属性name设置为Cache-Control这是在生产网站上。
我尝试过通过在以下配置文件中添加相同的部分来重现此内容:
C:\ Windows \ System32 \inetsrv\config \ applicationHost.config文件。
C:\ Windows \ Mesrosoft.NET \ Framework64 \v4.0.30319 \Config\web.config
但是上述步骤不起作用。
是否有其他全局配置文件需要设置才能重现此问题?
这是我调查的一部分造成这个错误的原因。
提前谢谢
我尝试了什么:
我试图通过广告在内部重现这一点将相同部分与以下配置文件相同:
C:\ Windows \ System32 \inetsrv\config \ applicationHost.config文件。
C:\ Windows \ microsoft.NET \ Framework64 \v4.0.30319 \Config\web.config
但上面的步骤不起作用。
参考此主题
如何解决错误无法添加重复的集合条目 [ ^ ]
I have a web.config file with following section
<system.webServer> <httpProtocol> <customHeaders> <add name="Cache-Control" value="no-cache"/> <add name="Pragma" value="no-cache"/> <add name="Expires" value="-1"/> <add name="X-UA-Compatible" value="IE=Edge,chrome=1"/> </customHeaders> </httpProtocol> </system.webServer>
When the website accessed in IIS it gives this error : Cannot add duplicate collection entry of type 'add' with unique key attribute 'name' set to 'Cache-Control' this was on production site.
I tried to reproduce this in house by adding same section to following configuration files:
C:\Windows\System32\inetsrv\config\applicationHost.config file.
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config\web.config
But above steps did not work.
Is there some other global configuration file that needs to be set to reproduce this issue?
This is part of my investigation to find the cause of this error.
Thanks in advance
What I have tried:
I tried to reproduce this in house by adding same section to following configuration files: C:\Windows\System32\inetsrv\config\applicationHost.config file. C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config\web.config But above steps did not work.
refer this thread
how to solve Error cannot add duplicate collection entry [^]
这篇关于web.config响应头问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!