Ankit Nagpal

Ankit Nagpal

  • NA
  • 1
  • 4.5k

the request failed with http status 417 expectation failed

Jan 29 2014 12:22 PM

I get this error when a SOAP web service is called from .NET 2.0 exe:

the request failed with http status 417 expectation failed

So, I tried 3 solutions:

  1. Added the following code just before the webservice call:

System.Net.ServicePointManager.Expect100Continue = false;

2. Edited app.config to add a

<system.net>
node as:
<?xml version="1.0"?> <configuration> <system.net> <settings> <servicePointManager expect100Continue="false" /> </settings> </system.net> // //.....All other app.config code..... // </configuration>

3. Created "Application Name".exe.config file where the "Application Name".exe file is located and wrote in it:

<configuration> <system.net> <settings> <servicePointManager expect100Continue="false" /> </settings> </system.net> </configuration>

Only solution no. 3 worked. Solution 1 and 2 caused same error.

But I do not want no. 3 as my solution. I prefer solution no. 1 in the following manner:

try {  webservice().webrequest(); } catch(Exception ex) { if(ex.Message == "the request failed with http status 417 expectation failed") { // //Do all code here for above exception then call the service //    webservice().webrequest(); } }

Second request is that the error occurs on another computer on different location/IP/network than mine, while Visual studio is installed on my computer where there is no error. So, is there any way to replicate the same scenario on my computer so that I can test it on my computer.