HOW TO FIX: The remote server returned an error: (400) Bad Request
<p>I'm trying to fix this error, I know that there are another similar questions with the same error, but the line: <code>request.ContentLength = 0;</code> it doesn't fix my exception.</p>

<p><strong>This is my image code:</strong> </p>

<pre><code>public ActionResult Index()
{
    Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture("en-US");
    Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-US");
    string serviceUrl = string.Format(@"http://localhost:61940/Service1.svc/GetPlayer/");

    HttpWebRequest request = (HttpWebRequest) WebRequest.Create(serviceUrl);
    request.Method = "POST";
    request.ContentType = @"application/json; charset=utf-8";
    request.ContentLength = 0;

    HttpWebResponse response = (HttpWebResponse) request.GetResponse();
    Stream stream = request.GetRequestStream();
    StreamWriter reader = new StreamWriter(stream);
}
</code></pre>

<p><strong>and this is my web.config</strong></p>

<pre><code>&lt;system.serviceModel&gt;
    &lt;services&gt;
    &lt;!-- This section is optional with the default configuration introduced
         in .NET Framework 4. --&gt;
        &lt;service name="WCF_Example.Service1"  behaviorConfiguration="mexBehavior"&gt;
          &lt;host&gt;
            &lt;baseAddresses&gt;
              &lt;add baseAddress="http://localhost:61940/"/&gt;
            &lt;/baseAddresses&gt;
          &lt;/host&gt;
          &lt;endpoint address="WCF_ServiceExample" binding="basicHttpBinding" contract="WCF_Example.IService1" /&gt;
          &lt;endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /&gt;
        &lt;/service&gt;
    &lt;/services&gt;

    &lt;bindings&gt;
      &lt;basicHttpBinding&gt;        
          &lt;binding name="transportSecurity"&gt;
            &lt;security mode="TransportWithMessageCredential"&gt;
              &lt;message clientCredentialType="UserName" /&gt;
            &lt;/security&gt;
          &lt;/binding&gt;
      &lt;/basicHttpBinding&gt;
    &lt;/bindings&gt;

    &lt;!--For debugging purposes set the includeExceptionDetailInFaults attribute to true--&gt;
    &lt;behaviors&gt;
      &lt;serviceBehaviors&gt;
        &lt;behavior name="mexBehavior"&gt;
          &lt;serviceMetadata httpGetEnabled="True"/&gt;
          &lt;serviceDebug includeExceptionDetailInFaults="false" /&gt;
        &lt;/behavior&gt;
      &lt;/serviceBehaviors&gt;
    &lt;/behaviors&gt;
  &lt;/system.serviceModel&gt;
</code></pre>

<p><strong>any help? thanks for the answers.</strong></p>

<p><strong>and this is my contract</strong></p>

<pre><code>[ServiceContract]
public interface IService1
{

    [OperationContract]
    [WebInvoke(UriTemplate = "GetPlayer", ResponseFormat = WebMessageFormat.Json)]
    Player GetPlayer();

    [OperationContract]
    CompositeType GetDataUsingDataContract(CompositeType composite);

    // TODO: Add your service operations here
}
</code></pre>