1、IIS7.0默认开启了不安全的OPTIONS和TRACE方法以下环境为windows server 2008、IIS7.0
2、web.config在<configuration>节点下添加如下代码:<system.webServer> &造婷用痃lt;security> <requestFiltering> <verbs allowUnlisted="false"> <add verb="GET" allowed="true"/> <add verb="POST" allowed="true"/> <add verb="HEAD" allowed="true"/> </verbs> </requestFiltering> </security></system.webServer>以上代码只允许开启GET、POST和HEAD方法。allowUnlisted="false":拒绝未列出的谓词。
3、IIS7.0 --> “授权规则”添加“允许”和“拒绝”规则,特定谓词只能填一个。IIS7.0 --> applicationHost.config文件位置:C:/Windows/System32/inetsrv/config/
4、若要配置 IIS 处理未列出的谓词的方式,请使用以下语法:appcmd set config /section:requestfiltering /verbs.allowunlisted:true| false例如,若要拒绝未列出的谓词,请在命令提示符处键入以下命令,然后按 Enter:appcmd set config /section:requestfiltering/verbs.allowunlisted:false
5、若要配置要筛选的谓词,请使用以下语法:appcmd set config /section:requestfiltering /+verbs.[verb='string ',allowed='true | false']变量 verb string 用于指定将应用此限制的谓词。例如,若要指定允许使用 GET,请在命令提示符处键入以下命令,然后按 Enter:appcmd set config /section:requestfiltering/+verbs.[verb='GET',allowed='true']