Вопрос

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.

Here is the 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);

I keep getting the error:

The server committed a protocol violation. Section=ResponseStatusLine

I did notice that the URL changes from HTTPS to HTTP could this be the problem?

I also tried adding the following to my config file and it still did not work:

<system.net> 
  <settings> 
    <httpWebRequest useUnsafeHeaderParsing="true" /> 
  </settings> 
</system.net> 

How can I fix this?

Это было полезно?

Решение

Here is how I fixed it...

I noticed that the URL was changing from HTTPS to HTTP...The HTTP URL was the culprit so I updated it to manually set the URL and it worked.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top