问题描述
几分钟前我工作的一个项目,在Visual Studio 2010,突然我的电脑已经重新启动。结果
重新启动后,我得到了在浏览本机的web站点时,下面的错误:
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:
请求失败,HTTP状态417:预期失败。
说明:在执行过程中发生未处理的异常
当前Web请求。有关详情,请堆栈跟踪
有关错误的信息它起源于code。
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.
异常详细信息:System.Net.WebException:请求失败,
HTTP状态417:预期失败
Exception Details: System.Net.WebException: The request failed with HTTP status 417: Expectation Failed.
我的网站的名称为: MyWebSite
结果
我有一个远程服务器(VPS一)该MyWebSite使用它在一个Web服务,该错误是与它的关系。
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: }
每一件事情是确定的有关Web服务。结果
所以,这是什么错误,我该如何解决?结果
有刚返回真实的网络服务中一个简单的布尔方法。结果
和我使用的网络servive在code,后面象下面这样:
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");
}
}
我删除Web服务,然后重新添加,但仍然有错误!结果
有什么错了?
i removed that web service and add it again, but still have that error!
what is wrong about that?
在此先感谢
推荐答案
你有GOOGLE了它? <一href=\"http://www.$c$cproject.com/Articles/94235/The-request-failed-with-HTTP-status-417-Expectatio\">This表明,问题是,不支持从服务器100继续响应的代理服务器,并且示出了code代表解决它。这可以解释为什么它的工作原理其他网络上。
Have you Googled it? 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.
既然你不可能说服你的ISP改变他们的做法(但在请求没有坏处),你应该关闭发送行为100继续为纽带建议有两种方法:
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:
把这个code。将Web请求前:
Putting this code before an web request:
System.Net.ServicePointManager.Expect100Continue = false;
或者,添加以下行到应用程序的配置文件作为一个孩子的&LT;结构&gt;
标签:
<system.net>
<settings>
<servicePointManager expect100Continue="false" />
</settings>
</system.net>
这篇关于请求失败,HTTP状态417:预期失败 - 使用Web服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!