[英]C# SOAP Web Service The server committed a protocol violation. Section=ResponseStatusLine
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. 我有一个调用Web服务的应用程序...我收到一个错误,我只是拔掉了我遗留的几根毛发,也许有人可以帮忙。
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
Section = ResponseStatusLine
I did notice that the URL changes from HTTPS to HTTP could this be the problem? 我确实注意到URL从HTTPS更改为HTTP ,这可能是问题吗?
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. 我注意到URL从HTTPS更改为HTTP ... HTTP URL是罪魁祸首,因此我对其进行了更新以手动设置URL,然后它起作用了。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.