title: The remote server returned an error : 400 badrequest in WCF
body: <p>In our project, we are calling the .svc file directly from asp.net web page and I receive the error "The remoter server returned an error:(400) bad request.</p>
  
  <p>Our project architecture is, we are using .svc file in our web application and the .cs file for the svc in writter in another class library project. From aspx, we are calling the WCF service directly without adding reference or anything. I cannot change the concept, because it is our standard. I'm able to add service reference and call those methods, but I wanted to call the method directly from .svc url.</p>
  
  <p>I'm pissed off for 2 days and could not resolve the error. We are using HttpWebRequest to get the response from the service. Basically, the service will take Data Transfer Object(DTO) as input and returns the same(DTO) as output with only one value.</p>
  
  <p>Check the following code:</p>
  
  <pre><code>HttpStatusCode statusCode = HttpHelper.PostXmlRequestValue(requestXMLInput, 
        string.Format("http://{0}/{1}/MySample.svc/webhttp/MyMethodName",  
        Request.ServerVariable["HTTP_HOST"], Request.ApplicationPath);  
  </code></pre>
  
  <p>The same code works in one machine but not in the other. I have checked the configuration and everything is same, but still I receive the same error.</p>
  
  <p>When I use the .svc url in my machine, it works, but gives a message "Method not allowed". When I checked the same url in the working machine, I got the same message.. I believe there is some simple thing I'm missing out. I couldn't find, as I'm new to WCF.</p>