Thursday 30 May 2013

WebException was unhandled by user code, The request failed with HTTP status 417: Expectation failed.

    In Windows Xp, I Am Trying To Send A Web Request Using A WebService.  Then It Showing The Exception "WebException was unhandled by user code, The request failed with HTTP status 417: Expectation failed.". I Had Tried A Lot To Solve This Bug..Finally i Had Found.


This Error Occurs When The Proxy Server Doesn't Support "100-Continue" Expectation .
Actually Expect "100-Countinue" Will Be True by Default In .NET Framwork.
To Work Around This Exception, You Can Do A Simple Thing: Disable Expect 100-Continue As Follows:.
We Have To Write A Line Of Code Before Making Web Requests:
i.e., System.Net.ServicePointManager.Expect100Continue = false;

or
Write The Below Lines In Config file between <configuration>  </configuration>

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

No comments:

Post a Comment

Note: only a member of this blog may post a comment.