C# post数据时 出现(417) Expectation Failed 的解决办法
2014-03-05 11:26
435 查看
MSDN查询的解决方式是
在config文件里面加上
<configuration>
<system.net>
<settings>
<servicePointManager expect100Continue="false" />
</settings>
</system.net>
</configuration>
这里有一个朋友的文章,描述了错误的发生
问题描述:
服务端环境:
linux + apache(lighttpd) + php5
客户端环境:
windowsxp + iis + .net
调用时出现如下错误:
System.Net.WebException: 远程服务器返回错误: (417) Expectation Failed。 在 System.Net.HttpWebRequest.GetResponse() 在 org.phprpc.PHPRPC_Client.POST(String requestString) 在 org.phprpc.PHPRPC_Client.Invoke(String function, Object[] args, Boolean byRef, Byte encryptMode)
为人检出错误:
将服务写在windows的机器上错误就没有了
经过牛人”神童哥“的指点:
写.net程序时在始化代码中,或者配置文件app.config之类的文件中
加下这么一句就可以了
ServicePointManager.Expect100Continue = false;
效果不错,问题解决
归纳其原因:
httpwebrequest控件有一个透明过程,先向服务方查询url是否存在而不发送POST的内容,服务器如果证实url是可访问的,才发送POST,早期的Apache就认为这是一种错误,而IIS却可以正确应答
在config文件里面加上
<configuration>
<system.net>
<settings>
<servicePointManager expect100Continue="false" />
</settings>
</system.net>
</configuration>
这里有一个朋友的文章,描述了错误的发生
C# post数据时 出现如下错误: System.Net.WebException: 远程服务器返回错误: (417) Expectation Failed 的解决办法
net(客户端)调用php(服务端)出现417错误问题描述:
服务端环境:
linux + apache(lighttpd) + php5
客户端环境:
windowsxp + iis + .net
调用时出现如下错误:
System.Net.WebException: 远程服务器返回错误: (417) Expectation Failed。 在 System.Net.HttpWebRequest.GetResponse() 在 org.phprpc.PHPRPC_Client.POST(String requestString) 在 org.phprpc.PHPRPC_Client.Invoke(String function, Object[] args, Boolean byRef, Byte encryptMode)
为人检出错误:
将服务写在windows的机器上错误就没有了
经过牛人”神童哥“的指点:
写.net程序时在始化代码中,或者配置文件app.config之类的文件中
加下这么一句就可以了
ServicePointManager.Expect100Continue = false;
效果不错,问题解决
归纳其原因:
httpwebrequest控件有一个透明过程,先向服务方查询url是否存在而不发送POST的内容,服务器如果证实url是可访问的,才发送POST,早期的Apache就认为这是一种错误,而IIS却可以正确应答
相关文章推荐
- C# 模拟post数据提交时 出现如下错误: System.Net.WebException: 远程服务器返回错误: (417) Expectation Failed 的解决办法
- [转]C# post数据时 出现如下错误: System.Net.WebException: 远程服务器返回错误: (417) Expectation Failed 的解决办法
- C# post数据时 出现如下错误: System.Net.WebException: 远程服务器返回错误: (417) Expectation Failed 的解决办法
- C# post数据时 出现如下错误: System.Net.WebException: 远程服务器返回错误: (417) Expectation Failed 的解决办法
- C# post数据时 出现如下错误: System.Net.WebException: 远程服务器返回错误: (417) Expectation Failed 的解决办法
- 在C#编程中要将一个表中的数据复制到另一个表中出现报错“该行已经属于另一个表”解决办法
- C#使用ListView更新数据出现闪烁解决办法
- django中使用jquery ajax post数据出现403错误的解决办法(两种方法)
- 远程服务器返回错误: (417) Expectation Failed 的解决办法
- C#使用ListView更新数据出现闪烁解决办法
- paip.远程服务器返回错误 (417) Expectation Failed 的解决办法
- django中使用jquery ajax post数据出现403错误的解决办法(两种方法)
- 运行出现Failed to access IIS metabase错误解决办法.
- windows下mysql主从出现Failed to open the relay log(relay_log_pos 248)解决办法
- ThinkPHP2.0操作MSSQL获取数据,出现Incorrect syntax near the keyword 'AS'. 错误的解决办法
- linux中搭建solr集群出现org.apache.catalina.LifecycleException: Failed to initialize component ,解决办法
- birt页面出现数据空白解决办法
- 使用Genymotion调试出现错误INSTALL_FAILED_CPU_ABI_INCOMPATIBLE解决办法
- FTP出现“数据 Socket 错误: 连接被拒”解决办法
- 【C#】操作SQLite数据库出现database is locked解决办法