title: C# SOAP Web Service The server committed a protocol violation. Section=ResponseStatusLine
body: <p>I have an application that calls a web service... I get an error that I am just pulling the few hairs I have left on my head out maybe someone can help.</p>
  
  <p>Here is the code:</p>
  
  <pre><code>Service_RetrieveIntervalDataserviceagent srv = new Service_RetrieveIntervalDataserviceagent();
  srv.Credentials = new NetworkCredential(UserName, Password, Domain);
  MDMIntervalDataInput dataInput = new MDMIntervalDataInput();
   string Url = srv.Url;
  DeviceList deviceList = new DeviceList();
  
  deviceList.Type = DeviceListType.M;
  deviceList.DeviceId = "2862,2876,2877".Split(',');
  
  //Setup dataInput
  dataInput.ApplicationName = "TestApp";
  dataInput.StartDate = DateTime.Now.AddDays(-3).ToString("MM/dd/yyyy");
  dataInput.EndDate = DateTime.Now.AddDays(-3).ToString("MM/dd/yyyy");
  dataInput.OutputMode = MDMIntervalDataInputOutputMode.Wire;
  dataInput.DeviceList = deviceList;
  srv.RetrieveIntervalData_V10(dataInput);
  </code></pre>
  
  <p>I keep getting the error:</p>
  
  <blockquote>
    <p>The server committed a protocol violation. Section=ResponseStatusLine</p>
  </blockquote>
  
  <p>I did notice that the URL changes from <em>HTTPS</em> to <em>HTTP</em> could this be the problem?</p>
  
  <p>I also tried adding the following to my config file and it still did not work:</p>
  
  <pre><code>&lt;system.net&gt; 
    &lt;settings&gt; 
      &lt;httpWebRequest useUnsafeHeaderParsing="true" /&gt; 
    &lt;/settings&gt; 
  &lt;/system.net&gt; 
  </code></pre>
  
  <p>How can I fix this?</p>