some minutes ago i was working on a project in visual studio 2010 and suddenly my pc was restarted.
after rebooting i got the error below when browsing that web site in local machine:
The request failed with HTTP status 417: Expectation Failed.
Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.Exception Details: System.Net.WebException: The request failed with
HTTP status 417: Expectation Failed.
my web site’s name is : MyWebSite
i have a web service on a remote server (a vps) that MyWebSite is using it and that error is in relationship with it.
Line 172: [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/MyWebSiteEnable", RequestNamespace="http://tempuri.org/", ResponseNamespace="http://tempuri.org/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
Line 173: public bool MyWebSiteEnable() {
Line 174: object[] results = this.Invoke("MyWebSiteEnable", new object[0]);
Line 175: return ((bool)(results[0]));
Line 176: }
every thing is ok about that web service.
so what is this error and how can i fix it?
there is just a simple bool method inside that web service that returns true.
and i am using that web servive in code-behind like below :
private void CheckForPageExpiration()
{
MyService service = new MyService();
if (service.MyWebSiteEnable())
{
}
else
{
Response.Redirect("~/blank.aspx");
}
}
i removed that web service and add it again, but still have that error!
what is wrong about that?
thanks in advance
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
This suggests that the problem is a proxy server that does not support a 100-continue response from the server, and shows code for resolving it. This would explain why it works on another network.
Since you are unlikely to convince your ISP to change their practice (no harm in a request though), you should turn off the behavior of sending a 100-Continue as the link suggests by either:
Putting this code before an web request:
System.Net.ServicePointManager.Expect100Continue = false;
Or, adding the following lines to the applications configuration file as a child of the <configuration> tag:
<system.net>
<settings>
<servicePointManager expect100Continue="false" />
</settings>
</system.net>
Method 2
Add below line of code in your config file.
<system.net>
<defaultProxy useDefaultCredentials="true" >
</defaultProxy>
</system.net>
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0