title: Web Service basicHTTPBinding
body: <p>I am new to web services and I need to implement basicHTTPBinding to an existing wpf c# desktop application that consumes a web service with WSHttpBinding. The web service has been already configured to both 
  bindings as following on the web.config file on the web service:</p>
  
  <pre><code>&lt;bindings&gt;
    &lt;wsHttpBinding&gt;
      &lt;binding name="HI_SSLBinding" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"&gt;
        &lt;security mode="TransportWithMessageCredential"&gt;
          &lt;transport clientCredentialType="Certificate" proxyCredentialType="None" realm="" /&gt;
          &lt;message clientCredentialType="UserName" negotiateServiceCredential="True" establishSecurityContext="True" /&gt;
        &lt;/security&gt;
      &lt;/binding&gt;
    &lt;/wsHttpBinding&gt;
  
    &lt;basicHttpBinding&gt;
      &lt;binding name="HI_BasicBinding" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"&gt;
        &lt;security mode="Transport"&gt;
          &lt;transport clientCredentialType="Certificate" proxyCredentialType="None" realm="" /&gt;
        &lt;/security&gt;
        &lt;readerQuotas maxStringContentLength="2147483647" /&gt;
      &lt;/binding&gt;
    &lt;/basicHttpBinding&gt;
  &lt;/bindings&gt;
  
  &lt;services&gt;
    &lt;service name="HIWebService.HIService" behaviorConfiguration="SecureBehave"&gt;
      &lt;endpoint address="basic" binding="basicHttpBinding" bindingConfiguration="HI_BasicBinding" contract="HILib.HIService.IHIService"&gt;&lt;/endpoint&gt;
      &lt;endpoint address="ws" binding="wsHttpBinding" bindingConfiguration="HI_SSLBinding" contract="HILib.HIService.IHIService"&gt;&lt;/endpoint&gt;
      &lt;host&gt;
        &lt;baseAddresses&gt;
          &lt;add baseAddress="https://10.50.1.85:1345/HI/HIService.svc" /&gt;
        &lt;/baseAddresses&gt;
      &lt;/host&gt;
    &lt;/service&gt;
  &lt;/services&gt;
  </code></pre>
  
  <p>The wpf c# desktop application has the App.configer to consume just the wsHttpBinding on the web service as following:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt;
  &lt;configuration&gt;
      &lt;system.serviceModel&gt;
         &lt;bindings&gt;
    &lt;wsHttpBinding&gt;
      &lt;binding name="HI_SSLBinding" closeTimeout="00:01:00"
          openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
          bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
          maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"
          messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"
          allowCookies="false"&gt;
  
          &lt;readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" /&gt;
        &lt;reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false" /&gt;
  
        &lt;security mode="TransportWithMessageCredential"&gt;
          &lt;transport clientCredentialType="Certificate" proxyCredentialType="None" realm="" /&gt;
          &lt;message clientCredentialType="UserName" negotiateServiceCredential="True" establishSecurityContext="True"/&gt;
        &lt;/security&gt;
       &lt;/binding&gt;
    &lt;/wsHttpBinding&gt;
  &lt;/bindings&gt;
  &lt;behaviors&gt;
    &lt;endpointBehaviors&gt;
      &lt;behavior&gt;
        &lt;clientCredentials&gt;
          &lt;serviceCertificate&gt;
            &lt;authentication certificateValidationMode="PeerOrChainTrust"/&gt;
          &lt;/serviceCertificate&gt;
        &lt;/clientCredentials&gt;
      &lt;/behavior&gt;
    &lt;/endpointBehaviors&gt;
  &lt;/behaviors&gt;
  &lt;client&gt;
    &lt;endpoint address="https://10.50.1.85:1345/HI/HIService.svc" binding="wsHttpBinding" bindingConfiguration="HI_SSLBinding" contract="HILib.HIService.IHIService"&gt;
  
    &lt;/endpoint&gt;
  &lt;/client&gt; 
  &lt;/system.serviceModel&gt;
   &lt;/configuration&gt;
  </code></pre>
  
  <p>Now when the application consumes the wsHttpBinding it does the following:</p>
  
  <pre><code>  System.ServiceModel.WSHttpBinding wsHTTPSBinding = new System.ServiceModel.WSHttpBinding();
              wsHTTPSBinding.Name = "HIBridge_SSLBinding";
              wsHTTPSBinding.OpenTimeout = TimeSpan.FromMinutes(1);
              wsHTTPSBinding.CloseTimeout = TimeSpan.FromMinutes(1);
              wsHTTPSBinding.SendTimeout = TimeSpan.FromMinutes(1);
              wsHTTPSBinding.ReceiveTimeout = TimeSpan.FromMinutes(10);
              wsHTTPSBinding.BypassProxyOnLocal = false;
              wsHTTPSBinding.TransactionFlow = false;
              wsHTTPSBinding.HostNameComparisonMode = System.ServiceModel.HostNameComparisonMode.StrongWildcard;
              wsHTTPSBinding.MaxBufferPoolSize = 2147483647;
              wsHTTPSBinding.MaxReceivedMessageSize = 2147483647;
              wsHTTPSBinding.MessageEncoding = System.ServiceModel.WSMessageEncoding.Text;
              wsHTTPSBinding.TextEncoding = Encoding.UTF8;
              wsHTTPSBinding.UseDefaultWebProxy = true;
              wsHTTPSBinding.AllowCookies = false;
  
  
              wsHTTPSBinding.ReliableSession.Ordered = true;
              wsHTTPSBinding.ReliableSession.InactivityTimeout = TimeSpan.FromMinutes(10);
              wsHTTPSBinding.ReliableSession.Enabled = false;
  
              wsHTTPSBinding.Security.Mode = System.ServiceModel.SecurityMode.TransportWithMessageCredential;
              wsHTTPSBinding.Security.Transport.ClientCredentialType = System.ServiceModel.HttpClientCredentialType.Certificate;
              wsHTTPSBinding.Security.Transport.ProxyCredentialType = System.ServiceModel.HttpProxyCredentialType.None;
              wsHTTPSBinding.Security.Transport.Realm = "";
              wsHTTPSBinding.Security.Message.ClientCredentialType = System.ServiceModel.MessageCredentialType.UserName;
              wsHTTPSBinding.Security.Message.NegotiateServiceCredential = true;
              wsHTTPSBinding.Security.Message.EstablishSecurityContext = true;
              System.ServiceModel.EndpointAddress endpointAddress = null;
  
              endpointAddress = new System.ServiceModel.EndpointAddress(string.Format("https://10.50.1.85:1345/HI/HIService.svc/ws");
  </code></pre>
  
  <p>How do I configure the App.configer for the BasicHttpBinding and how do I call this binding on the c# wpf application as well?</p>