title: Consume wcf service using HttpWebRequest c#
body: <pre><code>HttpWebRequest req = null;
  HttpWebResponse res = null;
  
  const string url = http://localhost/MyService/EService.svc/CreateMethod";
  
  req = (HttpWebRequest)WebRequest.Create(url);
  req.Method = "POST";
  req.ContentType = "application/json; charset=utf-8";
  
  req.Headers.Add("App", "Application");
  ASCIIEncoding encoder = new ASCIIEncoding();
  byte[] data = encoder.GetBytes("{ itemlist: 'sasfs' }");
  req.ContentLength = data.Length;
  
  res = (HttpWebResponse)req.GetResponse();
  Stream responseStream = res.GetResponseStream();
  var streamReader = new StreamReader(responseStream);
  
  string txt = streamReader.ReadToEnd();
  streamReader.Close();
  streamReader.Dispose();
  
  responseStream.Close();
  responseStream.Dispose();
  </code></pre>
  
  <p>I have to use above code to consume service, but i am getting different errors-
  1) You must provide a request body if you set ContentLength>0 ....
  What is the code I am missing exactly here.</p>