【问题标题】:How to force ASP.NET Web Service expose only HTTP-POST interface如何强制 ASP.NET Web 服务只公开 HTTP-POST 接口
【发布时间】:2010-01-05 11:40:43
【问题描述】:

创建一个新的 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>

【问题讨论】:

  • 我修改了我的答案 - 新答案应该适合你。

标签: asp.net web-services http wsdl


【解决方案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

【讨论】:

  • 是否可以通过 c# 属性在代码中配置协议?
  • 我找不到任何记录在案的方法。 web.config 解决方案是我能找到的唯一解决方案。
猜你喜欢
  • 1970-01-01
  • 2010-10-15
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-12-07
  • 1970-01-01
  • 2010-10-11
  • 2011-03-05
相关资源
最近更新 更多