【发布时间】:2012-10-03 06:50:37
【问题描述】:
我正在编写使用我的 wcf 服务的 windows 8 应用程序。(在 Visiual Studio 2012 上)。当我在家尝试时它运行良好,因此它可以连接到 wcf。但是当我在我的办公室尝试时,它无法连接到 wcf 并返回错误:
远程服务器返回错误:(417) 预期失败。
我认为它是由办公网络中的防火墙引起的.. 谷歌搜索太多,尝试了很多,但问题仍然存在。
System.Net.ServicePointManager.Expect100Continue = false;
不起作用,因为 .Net Framework 4.5 没有 ServicePointManager 类,但 msdn 说 .Net 4.5 上有 ServicePointManager .. http://msdn.microsoft.com/en-us/library/system.net.servicepointmanager.expect100continue.aspx
<system.net>
<settings>
<servicePointManager expect100Continue="false" />
</settings>
</system.net>
无法尝试在 web.config 或 app.config 上写入,因为 win8 应用程序没有这些文件..
有些人将上面的代码写入VS 2012的devenv.exe.config文件。我试过了,但没有任何改变。
【问题讨论】:
-
当我的网络服务调用被代理阻止时,我已经看到了这个错误