【问题标题】:CustomBinding lacks a TransportBindingElement when trying to add GZip compression to WCF尝试将 GZip 压缩添加到 WCF 时,CustomBinding 缺少 TransportBindingElement
【发布时间】:2016-02-24 10:48:48
【问题描述】:

我正在尝试将 GZip 添加到我的 WCF 服务的绑定中,但出现下一个错误

The Scheme cannot be computed for this binding because this CustomBinding lacks a TransportBindingElement.  Every binding must have at least one binding element that derives from TransportBindingElement.

我的网络配置包含以下内容:

 <bindings>
      <customBinding>
        <binding name="BinaryCompressionBinding">
          <binaryMessageEncoding compressionFormat ="GZip"/>
          <httpTransport />
        </binding>
      </customBinding>
      <webHttpBinding>
        <binding closeTimeout="00:10:00" transferMode="StreamedResponse" openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00" maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647">
          <readerQuotas maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647"/>
        </binding>
      </webHttpBinding>
    </bindings>
    <services>
      <service behaviorConfiguration="myServiceBehavior" name="SMS.Example.Service">
        <endpoint address="" behaviorConfiguration="customBinding" binding="customBinding" name="customBinding" contract="SMS.Example.IService"/>
        <endpoint address="mex" binding="mexHttpBinding" name="mexHttpBinding" contract="IMetadataExchange"/>
      </service>
    </services>

这可能是什么原因造成的?

【问题讨论】:

    标签: c# .net web-services wcf web-config


    【解决方案1】:

    您的端点节点有问题。缺少绑定配置属性。添加 bindingConfiguration="BinaryCompressionBinding" 并重试。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-01-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-07-14
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多