本文介绍了WCF |如何删除响应标头,如“服务器”,ASPNetVersion,“Powered”等。等等的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,


为了安全起见,我要求我不应该披露服务器,asp.net版本等响应标头。 


如何在为WCF服务进行呼叫时限制这些标头。



我已经尝试过以下配置设置但适用于aspx页面调用但不适用于WCF服务调用。


  <?  xml version   =  " 1.0"   encoding   =  " utf-8"  ?>   
< configuration>
< system webServer >
< httpProtocol>
< customHeaders>
< remove name = "服务器" />
< remove name = "X-Powered-By" />
< remove name = " X-AspNet-Version" />
< / customHeaders >
< / httpProtocol >
< / system webServer >
< / configuration >


谢谢,


Mantesh MB

解决方案

Hi all,

I have requirement where in for security reason I am not supposed to disclose response headers like server, asp.net version etc. 

How can I restrict these headers when calls are made for WCF services.

I have already tried the below config settings but works fine for aspx page calls but not for WCF service calls.

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <system.webServer>
    <httpProtocol>
      <customHeaders>
        <remove name="Server" />
        <remove name="X-Powered-By" />
        <remove name="X-AspNet-Version" />
      </customHeaders>
    </httpProtocol>
  </system.webServer>
</configuration>

Thanks,

Mantesh M. B.

解决方案


这篇关于WCF |如何删除响应标头,如“服务器”,ASPNetVersion,“Powered”等。等等的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-26 04:53