Quantcast
Channel: VBForums - WPF, WCF, WF
Viewing all articles
Browse latest Browse all 256

WCF programmatically instantiate app.config settings

$
0
0
I have written a WCF service. This is the App.config file for the client application that consumes the service. I want all of this data to be set with the client application's code. How can I do this?

Code:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <startup>
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
    </startup>

  <system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding name="BasicHttpBinding_IHelloWorldService" allowCookies="true"
                maxReceivedMessageSize="20000000" maxBufferSize="20000000"  maxBufferPoolSize="20000000">
            <readerQuotas maxDepth="32"
                    maxArrayLength="200000000"
                    maxStringContentLength="200000000"/>
          <security mode="None">
            <transport clientCredentialType="None" />
            <message clientCredentialType="UserName" />
          </security>
        </binding>
      </basicHttpBinding>
    </bindings>
    <client>
     
    <endpoint address="http://localhost/HelloWorldService.svc"
          binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IHelloWorldService"
          contract="HelloWordServiceReference.IHelloWorldService"
          name="BasicHttpBinding_IHelloWorldService" />
   
    </client>
  </system.serviceModel>
 
</configuration>


Viewing all articles
Browse latest Browse all 256

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>