title: Configure WCF Client to consume a WCF Service using HTTP GET
body: <p>I have a WCF Service which allows only HTTP GET requests:</p>
  
  <pre><code>[WebInvoke(Method="GET", ResponseFormat=WebMessageFormat.Json)]
  public string GetAppData()
  </code></pre>
  
  <p>The service is exposed using webHttpBinding</p>
  
  <pre><code>&lt;system.serviceModel&gt;
  &lt;bindings&gt;
    &lt;webHttpBinding&gt;
      &lt;binding name="AppSvcBinding"&gt;
        &lt;security mode="TransportCredentialOnly"&gt;
          &lt;transport clientCredentialType="Windows" /&gt;
        &lt;/security&gt;
      &lt;/binding&gt;
    &lt;/webHttpBinding&gt;
  &lt;/bindings&gt;
      &lt;behaviors&gt;
  </code></pre>
  
  <p>
      
       
      
     
     
      
       
       
      
     
    
          
          
              
                  
            
              
            
          
        
          
      </p>
  
  <p>I have my client whose config looks like</p>
  
  <pre><code>&lt;system.serviceModel&gt;
      &lt;client&gt;
          &lt;endpoint address="http://localhost/AppService/Service.svc" 
              binding="webHttpBinding" 
              bindingConfiguration="webHttpBindingConfig"
              contract="AppSvc.IService" 
              behaviorConfiguration="AppSvcBehavior"
              name="AppSvcClient"&gt;
      &lt;identity&gt;
        &lt;dns value="localhost"/&gt;
      &lt;/identity&gt;
    &lt;/endpoint&gt;
      &lt;/client&gt;
  &lt;bindings&gt;
    &lt;webHttpBinding&gt;
      &lt;binding name="webHttpBindingConfig"&gt;
        &lt;security mode="TransportCredentialOnly"&gt;
          &lt;transport clientCredentialType="Windows" /&gt;
        &lt;/security&gt;
      &lt;/binding&gt;
    &lt;/webHttpBinding&gt;
  &lt;/bindings&gt;
  &lt;behaviors&gt;
    &lt;endpointBehaviors&gt;
      &lt;behavior name="AppSvcBehavior"&gt;
        &lt;webHttp/&gt;
      &lt;/behavior&gt;
    &lt;/endpointBehaviors&gt;
  &lt;/behaviors&gt;
  &lt;/system.serviceModel&gt;
  </code></pre>
  
  <p>My client code is a simple</p>
  
  <pre><code>ServiceClient client = new ServiceClient("AppSvcClient");
  String result = client.GetAppData();
  </code></pre>
  
  <p>On executing this code I get the error:</p>
  
  <blockquote>
    <p>The remote server returned an unexpected response: (405) Method Not Allowed.</p>
  </blockquote>
  
  <p>I checked with fiddler and found that my client is sending a POST message whereas the service expects a GET hence the error.</p>
  
  <p>I wish to know how to configure the client so that is sends GET request to the service.</p>