[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More


The request failed with HTTP status 417: Expectation failed.

Published on
8,899 Points
Last Modified:
When using WebServices and calling some Web Methods, you may come across to this exception:
The request failed with HTTP status 417: Expectation failed.
When Expect 100-Continue property is set to true (this is actually set within part of the .Net framework, which makes this a difficult problem to overcome.  You have to override this in more than one place), this 417 error occurs when the proxy server doesn't support 100-Continue.

In the case of expect 100-Continue, the client will expect to receive a 100-Continue response from the server to indicate that the client should send the data to be posted. This mechanism allows clients to avoid sending large amounts of data over the network when the server, based on the request headers, intends to reject the request.

The Expect 100-Continue behavior is fully described in IETF RFC 2616 Section 10.1.1.

You can also read more about it in MSDN.

To workaround this exception you can do a simple thing: Disable expect 100 continue.

So you may ask how to disable expect 100 continue?

Warning: When you disable Expect 100-Continues and your application sends a large amount of data on the network, if for any reason the server rejects your request, you have to re-send the entire data again, this may cause some extra traffic in your network. Also multiple calls to a server will take longer, since each call will wait until the prior call's response is received.

It is easy, here are two alternative ways:

1) We need to have this line of code before making any web requests.

System.Net.ServicePointManager.Expect100Continue = false;

Open in new window

2) Add these lines to the application's configuration file (between  and ):

  <servicePointManager expect100Continue="false" />

Open in new window

While this workaround is nice, I think a better long term solution is to upgrade/replace the proxy server to handle 100-continue calls.

So far in this short tip we've learned what is Expect 100, how it is caused and how to workaround this expectation.

Featured Post

Why Diversity in Tech Matters

Kesha Williams, certified professional and software developer, explores the imbalance of diversity in the world of technology -- especially when it comes to hiring women. She showcases ways she's making a difference through the Colors of STEM program.

Join & Write a Comment

If you, like me, have a dislike for using Online Subscription anti-spam services, then this video series is for you. I have an inherent dislike of leaving decisions such as what is and what isn't spamming to other people or services for me and insis…
There are many cases found where ScanPST.exe fails to repair corrupt Outlook PST File. When user tries to repair PST using Inbox Repair tool and it throws below error: •      Inbox Repair tool does not recognize the file •      ScanPST.exe hangs in betwee…

Keep in touch with Experts Exchange

Tech news and trends delivered to your inbox every month