title: ChannelFactory with WebHttpBinding always POSTs while executing a ServiceContract OperationContract
body: <p>I have a service that is hosted via WebServiceHost and I need to delegate some of the calls to other REST services on the web.</p>
  
  <p>I built a ClientBase concrete class to handle this. The flow looks like this:</p>
  
  <p><a href="http://localhost:8000/users/my@email.com" rel="nofollow">http://localhost:8000/users/my@email.com</a> -> My WebServiceHost instance -> ClientBase -> REST service</p>
  
  <p>Everything was working well, until I realized that ALL calls coming from ClientBase were using POST as the verb. In order to make sure I wasn't doing anything silly with ClientBase I built a ChannelFactory manually and used that. No luck, every call still used POST regardless of ClientBase, ChannelFactory, and even ServiceContract decorations.</p>
  
  <p>I then started isolating code and realized my simple ChannelFactory worked when the original call wasn't coming from within a request my WebServiceHost was handling.</p>
  
  <p>Here's a distilled Program.cs that exhibits the exact problem, the MakeGetCall() from Program.Main works as intended, but the call from MyService.GetUser will always POST:</p>
  
  <pre><code>class Program
  {
      static void Main(string[] args)
      {
          //Program.MakeGetCall(); //This works as intended even when changing the WebInvoke attribute parameters
  
          WebServiceHost webServiceHost = new WebServiceHost(typeof(MyService), new Uri("http://localhost:8000/"));
  
          ServiceEndpoint serviceEndpoint = webServiceHost.AddServiceEndpoint(typeof(IMyServiceContract), new WebHttpBinding(), "");
  
          webServiceHost.Open();
  
          Console.ReadLine();
      }
  
      public static void MakeGetCall()
      {
          ServiceEndpoint endpoint = new ServiceEndpoint(
              ContractDescription.GetContract(typeof(IMyServiceContract)),
              new WebHttpBinding(),
              new EndpointAddress("http://posttestserver.com/post.php"));
  
          endpoint.Behaviors.Add(new WebHttpBehavior());
  
          ChannelFactory&lt;IMyServiceContract&gt; cf = new ChannelFactory&lt;IMyServiceContract&gt;(endpoint);
  
          IMyServiceContract test = cf.CreateChannel();
  
          test.GetUser("test");
      }
  
  }
  
  [ServiceContract]
  public interface IMyServiceContract
  {
      [OperationContract]
      [WebInvoke(Method = "GET", ResponseFormat = WebMessageFormat.Json,
          UriTemplate = "/users/{emailAddress}")]
      string GetUser(string emailAddress);
  }
  
  public class MyService : IMyServiceContract
  {
      public string GetUser(string emailAddress)
      {
          Program.MakeGetCall(); //This will ALWAYS POST no matter if you are using [WebInvoke(Method="GET")] or even [WebGet]
  
          return "foo";
      }
  }
  </code></pre>