2012-10-16 97 views
0

我有一個應用程序調用Web服務...我得到一個錯誤,我只是把我頭上留下的幾根頭髮,也許有人可以幫助。C#SOAP Web服務服務器違反協議。部分= ResponseStatusLine

下面是代碼:

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); 

我不斷收到錯誤:

The server committed a protocol violation. Section=ResponseStatusLine

我也注意到,從HTTPSHTTP的URL變化可能這個問題?

我也嘗試添加以下到我的配置文件,它仍然沒有奏效:

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

我該如何解決這個問題?

回答

0

這是我如何固定它...

我注意到URL從HTTPS更改爲HTTP ...的HTTP URL是罪魁禍首,所以我更新它來手動設置URL和它的工作。

相關問題