C# 通过ProxyServer发送WCF请求

C# 通过ProxyServer发送WCF请求,c#,wcf,wcf-binding,wcf-extensions,C#,Wcf,Wcf Binding,Wcf Extensions,这是我的客户端WCF配置文件: <configuration> <system.net> <defaultProxy enabled="true" useDefaultCredentials="true"> <proxy usesystemdefault="False" bypassonlocal="False" proxyaddress="ht

这是我的客户端WCF配置文件:

<configuration>

  <system.net>
    <defaultProxy 
      enabled="true" 
      useDefaultCredentials="true">

      <proxy 
        usesystemdefault="False" 
        bypassonlocal="False" 
        proxyaddress="http://172.20.20.254:8088/"
      />

    </defaultProxy>
  </system.net>

<system.serviceModel>
  <client>
    <endpoint
      address="http://172.20.20.100:8080/Demo/text"
      binding="customBinding"
      bindingConfiguration="text"
      contract="DemoService.IDemoService"
      behaviorConfiguration="largeObjectGraph_behaviorConfig"
      name="text" />
  </client>

  <!-- Allow To Desrialize Larg Data -->
  <behaviors>
    <endpointBehaviors>
      <behavior name="largeObjectGraph_behaviorConfig">
        <dataContractSerializer maxItemsInObjectGraph="2147483646"/>
      </behavior>
    </endpointBehaviors>
  </behaviors>

  <bindings>
    <customBinding>

      <binding name="text" 
               closeTimeout="10675199.02:48:05.4775807" 
               openTimeout="10675199.02:48:05.4775807"
               receiveTimeout="10675199.02:48:05.4775807" 
               sendTimeout="10675199.02:48:05.4775807">

        <CustomMessageEncoder 
              MaxArrayLength="1073741824" 
              MaxBytesPerRead="1073741824"
              MaxDepth="1073741824" 
              MaxNameTableCharCount="1073741824" 
              MaxStringContentLength="1073741824" />

        <httpTransport 
          maxBufferPoolSize="1073741824" 
          maxReceivedMessageSize="1073741824"
          maxBufferSize="1073741824" />

      </binding>
    </customBinding>
  </bindings>

  <extensions>
    <bindingElementExtensions>
      <add name="CustomMessageEncoder" type="CustomMessageEncoder.CustomMessageEncodingElement, CustomMessageEncoder, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
    </bindingElementExtensions>
  </extensions>

    </system.serviceModel>
</configuration>

使用CustomMessageEncoder绑定来压缩和加密消息

问题是:我们的局域网中有代理服务器[172.20.20.254:8088]

我从ControlPannel更改了SystemDefaultProxy它不工作

并在客户端配置文件中使用一些选项,如您在此处看到的,steel不工作



中有
proxyAddress
useDefaultProxy
属性。尝试设置,对于像basic&ws这样的绑定,intellisense会显示属性,但在自定义绑定中会显示属性,并且baseEncodingElement TextMessageEncodingBindingElement TextMessageEncodingBindingElement.ReaderQuotas没有该属性:((
<customBinding>
  <binding name="MyCustomClientBinding">
    <binaryMessageEncoding />
    <httpTransport proxyAddress="http://gateway:8080" useDefaultWebProxy="false" />
  </binding>
</customBinding>