Advertisement
Guest User

App.config for WCF service client

a guest
Oct 18th, 2011
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
XML 3.85 KB | None | 0 0
  1. <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2.                                              WCF
  3. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
  4. <system.serviceModel>
  5.  
  6.   <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  7.        Behaviors
  8.  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
  9.   <behaviors>
  10.     <endpointBehaviors>
  11.  
  12.       <behavior name="FooBehavior">
  13.  
  14.         <!--
  15.          The clientCredentials behavior allows one to define a certificate to present
  16.          to a service. A certificate is used by a client to authenticate itself to the service
  17.          and provide message integrity. This configuration references the "client.com"
  18.          certificate installed during the setup instructions.
  19.        -->
  20.         <clientCredentials>
  21.  
  22.           <serviceCertificate>
  23.  
  24.             <!--
  25.              Setting the certificateValidationMode to PeerOrChainTrust means that if
  26.              the certificate  is in the user's Trusted People store, then it will be
  27.              trusted without performing a validation of the certificate's issuer chain.
  28.              This setting is used here for convenience so that the sample can be run
  29.              without having to have certificates issued by a certificate authority (CA).
  30.              
  31.              This setting is less secure than the default, ChainTrust. The security
  32.              implications of this  setting should be carefully considered before using
  33.              PeerOrChainTrust in production code.
  34.            -->
  35.             <authentication certificateValidationMode="None" />
  36.             <!-- PeerOrChainTrust -->
  37.  
  38.           </serviceCertificate>
  39.  
  40.         </clientCredentials>
  41.  
  42.       </behavior>
  43.  
  44.     </endpointBehaviors>
  45.   </behaviors>
  46.  
  47.   <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  48.        Bindings
  49.  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
  50.   <bindings>
  51.  
  52.     <wsHttpBinding>
  53.       <binding
  54.        name="FooBinding"
  55.        openTimeout="00:01:00" closeTimeout="00:01:00"
  56.        receiveTimeout="00:10:00" sendTimeout="00:01:00"
  57.        maxBufferPoolSize="5242880" maxReceivedMessageSize="655360"
  58.        useDefaultWebProxy="true" bypassProxyOnLocal="false"
  59.        messageEncoding="Text" textEncoding="utf-8"
  60.        hostNameComparisonMode="StrongWildcard"
  61.        allowCookies="false"
  62.        transactionFlow="false"
  63.      >
  64.         <readerQuotas
  65.          maxDepth="32"
  66.          maxStringContentLength="81920"
  67.          maxArrayLength="163840"
  68.          maxNameTableCharCount="163840"
  69.          maxBytesPerRead="4096"
  70.        />
  71.         <reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false" />
  72.         <security mode="Message">
  73.           <transport clientCredentialType="Windows" proxyCredentialType="None" realm="" />
  74.           <message
  75.            clientCredentialType="Certificate" negotiateServiceCredential="true"
  76.            algorithmSuite="Default"
  77.          />
  78.         </security>
  79.       </binding>
  80.     </wsHttpBinding>
  81.  
  82.   </bindings>
  83.  
  84.   <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  85.        Services
  86.  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
  87.   <client>
  88.     <endpoint
  89.      name="FooEndPoint"
  90.      address="http://foo.company.com:1234/FooService.svc"
  91.      contract="Service.IFooService"
  92.      binding="wsHttpBinding"
  93.      bindingConfiguration="FooBinding"
  94.      behaviorConfiguration="FooBehavior"
  95.    >
  96.       <identity>
  97.         <dns value="Foo Service" />
  98.       </identity>
  99.     </endpoint>
  100.   </client>
  101.  
  102. </system.serviceModel>
  103.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement