我的应用程序使用 Web 服务,但在应用程序启动后的第一次尝试中总是收到以下异常:System.Net.WebException 内部异常 System.InvalidOperationException 和无法评估表达式 消息。这仅发生在 Web 服务上,而不发生在 HttpWebRequest 上。有什么线索吗?
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)
最佳答案
发现问题是因为当我的 Web 服务发送 Expect 100 header 时,我的 Squid Proxy 2.7 返回 HTTP 状态 417。为了解决这个问题,我必须在调用网络服务之前添加以下行。
System.Net.ServicePointManager.Expect100Continue = false;
关于c# - 在 Windows Mobile 6.5 上使用 Web 服务时导致 WebException 的原因是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5845971/