如何强制ASP.NET Web服务仅公开HTTP-POST接口

时间:2010-01-05 11:40:44

标签: asp.net web-services http wsdl

创建新的ASP.NET Web服务后,我只想要support HTTP-POST for incoming data。如何强制WSDL反映该策略?

客户端的WSDL应该如何只启用HTTP-POST和在WSDL中禁用SOAP 1.1和SOAP 1.2

解决方案:

<system.web>
<webServices>
  <protocols>
    <clear />
    <add name="HttpPost"/>
    <add name="Documentation"/>
  </protocols>
  <conformanceWarnings>
    <remove name='BasicProfile1_1'/>
  </conformanceWarnings>
</webServices>

1 个答案:

答案 0 :(得分:1)

请参阅此答案:Is it possible to restrict certain ASMX web service methods to GET or POST only?

[ScriptMethod(UseHttpGet = false)]

修改 - 更多信息

您是否在web.config中试过这个?

<configuration>
   <system.web>
      <webServices>
         <protocols>
            <clear />
            <add name="HttpPost"/>
         </protocols>
      </webServices>
   <system.web>
</configuration>

阅读本文档后,我想到了这个想法:

http://msdn.microsoft.com/en-us/library/ccbk8w5h(VS.85).aspx