4

I would like to turn on compression in my SOAP WCF requests. The solution described here works perfectly. It involves 2 parts:

  1. The implementation of a IWebRequestCreate inherited class which turns on compression. This is not a problem.

  2. Specifying in the app.config file that the above mentioned class should be used. This is done with this XML in the app.config file:

:

<configuration>
  <system.net>
    <webRequestModules>
      <remove prefix="http:"/>
      <add prefix="http:" 
            type="Pajocomo.Net.CompressibleHttpRequestCreator, Pajocomo" />
    </webRequestModules>
  </system.net>
</configuration>

However, this is a problem, as this C# project is a DLL (an SSIS data flow component), and it cannot 'see' the app.config file (nor do we want to modify the calling .exe's config file).

The question here describes a workaround for this problem (in short, creating BasicHttpBinding and EndpointAddress objects and sending them to the client's c'tor). I have successfully used this to some extent to allow for proxy's, alter timeouts, change the service's URL, etc.

However, I cannot figure out the mechanism to replace the above XML in a similar manner.

Community
  • 1
  • 1
Marc Bernier
  • 2,928
  • 27
  • 45
  • can i ask why you are reluctant to change the calling exe's config file? WCF by design allows/enables this kind of configuration from config files so it is a logical place for it (not 'buried' in your dll) – wal Apr 26 '12 at 15:50
  • This is an SSIS component. SSIS packages can be run from BIDS (ie, VS), a command line, SQL management studio, and possibly other places. Also, it is possible that the user would configure one instance of the component one way, and a second instance in another way. – Marc Bernier Apr 26 '12 at 16:05

0 Answers0