Pergunta

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)
Foi útil?

Solução

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;
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top