【问题标题】:Generate non-duplex proxy code for a SOAP webservice为 SOAP Web 服务生成非双工代理代码
【发布时间】:2013-09-03 07:19:30
【问题描述】:

当我通过添加服务引用来生成 Web 服务代理类时,代码生成器会实现一个基于 DuplexClientBase 类的代理。此实现需要启用双工的绑定配置。因为,当使用双工时,似乎只有wsDualHttpBinding 有效。

我想生成一个没有双工合同的类。我可以指示 Visual Studio 或 svcutil.exe 不生成双工代码吗? Web 服务是基于 SOAP 的,所以我无法想象为什么我实际上需要双工。

服务的web.config如下:

<system.serviceModel>
    <services>
      <service behaviorConfiguration="IncidentBehavior" name="omwWS.ServiceImplementation.Incident">
        <endpoint address="" binding="customBinding" bindingConfiguration="CustomBinding_IIncident"
          contract="omwWS.ServiceContracts.IncidentAccess" />
      </service>
    </services>
    <bindings>
      <customBinding>
        <binding name="CustomBinding_IIncident">
          <textMessageEncoding messageVersion="Soap12WSAddressingAugust2004" />
          <httpsTransport authenticationScheme="Basic" maxReceivedMessageSize="52428800" maxBufferSize="52428800" />
        </binding>
      </customBinding>
    </bindings>
    <behaviors>
      <serviceBehaviors>
        <behavior name="IncidentBehavior">
          <serviceDebug includeExceptionDetailInFaults="true" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
  </system.serviceModel>

【问题讨论】:

  • 你试过wsdl.exe吗?

标签: .net soap binding duplex


【解决方案1】:

最简单的方法是使用添加 Web 服务引用而不是使用添加服务引用。

因为你的服务是简单的结构化soap服务,没有双工等高级场景

通信,客户端不会丢失任何东西。

在“添加服务参考”窗口中,点击高级按钮,提供地址并点击添加参考。

它将基于 .NET 2 技术为您生成客户端

如果需要任何其他信息,请告诉我。

祝你好运

【讨论】:

  • 我已经尝试过这个选项并且生成的代码不起作用,因为 .NET 2.0 代码不支持 WS Adressing。我找到了一种解决方法,通过添加对 WSE 3.0 程序集的引用,使 2.0 客户端使用 ws 寻址,但我仍然想使用 WCF 连接到此服务。
猜你喜欢
  • 2011-02-15
  • 2011-02-08
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多