Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sending WCF requests through ProxyServer

here is my client side WCF Config file :

<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>

using CustomMessageEncoder binding in order to compress and encrypt Messages.

here is problem : we have Proxy-Server[172.20.20.254:8088] in our LAN.

i changed SystemDefaultProxy from ControlPannel it doesn't work !

and use some option in client Config file like u see here and steel doesn't work

like image 629
patachi Avatar asked Dec 21 '22 06:12

patachi


1 Answers

here is the source : http://blogs.infosupport.com/configuring-a-proxy-server-for-wcf/

<customBinding>
  <binding name="MyCustomClientBinding">
    <binaryMessageEncoding />
    <httpTransport proxyAddress="http://gateway:8080" useDefaultWebProxy="false" />
  </binding>
</customBinding> 
like image 161
Zabihullah Alipour Avatar answered Jan 01 '23 03:01

Zabihullah Alipour