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[] parameter开发者_C百科s)
...
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;
精彩评论