简体   繁体   中英

What cause WebException when consuming Web Service on Windows Mobile 6.5?

My application consume a web service but always receive the following expception on first try after the application is started: System.Net.WebException with inner exception System.InvalidOperationException and Could not evaluate expression message. This only occurs for web service and not on HttpWebRequest. Any clue?


       at System.Web.Services.Protocols.SoapHttpClientProtocol.doInvoke(String methodName, Object[] parameters, WebClientAsyncResult asyncResult)
       at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
       ...
       at System.Windows.Forms.Application.Run(Form fm)
       at Example.Program.Main(String[] args)

Found out the problem is because my Squid Proxy 2.7 is returning HTTP Status 417 when my web service sends Expect 100 header. To solve this I have to add the following line before invoking the web service.

System.Net.ServicePointManager.Expect100Continue = false;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM