Sash
Sash

Reputation: 493

WCF client app.config in Class Library

I have a Class Library project that contains a WCF client: the configuration and a lot of logic associated with it.

This DLL will be used by multiple client applications that have to consume exactly the same contract.

The issue is that the config resides in the DLL, but each client application has different endpoint address and client certificate.

How can I "inject" values from the client application into the attributes with '????????' value in the DLL's config?

    <endpoint address="????????" 
              binding="customBinding"
              bindingConfiguration="NewBinding0" 
              name="yyyy"
              contract="bbbbb" />
...
    <behavior name="TestBehavior">
      <clientCredentials>
        <clientCertificate storeLocation="LocalMachine" storeName="My" 
                           x509FindType="FindByThumbprint" findValue="????????" />

      </clientCredentials>
    </behavior>
...

Thanks :)

Upvotes: 1

Views: 1045

Answers (1)

to StackOverflow
to StackOverflow

Reputation: 124696

The config file in your DLL project will be used by Visual Studio, for example when updating service references: it isn't used at runtime.

Each client application that uses the DLL will need to have its own configuration file with the relevant configuration section in order to use the service at runtime.

Upvotes: 2

Related Questions