Windows Phone 7 一分钟后抛出 EndpointNotFoundException
在我的应用程序中调用 WCF 服务一分钟后会引发 EndpointNotFoundException。所有超时时间都超过一分钟。
var binding = new BasicHttpBinding {
OpenTimeout = TimeSpan.FromMinutes(3),
CloseTimeout = TimeSpan.FromMinutes(6),
ReceiveTimeout = TimeSpan.FromMinutes(2),
SendTimeout = TimeSpan.FromMinutes(5)
};
client = new ServiceClient(binding, new EndpointAddress("http://..."));
client.InnerChannel.OperationTimeout = TimeSpan.FromMinutes(4);
我在微软论坛上找到了一个帖子,但没有解决方案。 http://social.msdn.microsoft.com/Forums/ar/windowsphone7series/thread/cba9c633-6d79-4c04-8c08-cd0b5b33d8c6
仅当服务运行时间超过一分钟。 调用此服务会抛出 EndpointNotFoundException:
public string Test() {
Thread.Sleep(60000);
return "test";
}
但调用此服务可以正常工作:
public string Test() {
Thread.Sleep(58000);
return "test";
}
Calling a WCF Service in my application throws EndpointNotFoundException after one minute. All timeouts are more than one minute.
var binding = new BasicHttpBinding {
OpenTimeout = TimeSpan.FromMinutes(3),
CloseTimeout = TimeSpan.FromMinutes(6),
ReceiveTimeout = TimeSpan.FromMinutes(2),
SendTimeout = TimeSpan.FromMinutes(5)
};
client = new ServiceClient(binding, new EndpointAddress("http://..."));
client.InnerChannel.OperationTimeout = TimeSpan.FromMinutes(4);
I found a thread on Microsoft's forum, but there is no solution.
http://social.msdn.microsoft.com/Forums/ar/windowsphone7series/thread/cba9c633-6d79-4c04-8c08-cd0b5b33d8c6
The problem occurs only with services that work out more than one minute.
Invoke of this service throws EndpointNotFoundException:
public string Test() {
Thread.Sleep(60000);
return "test";
}
But invoke of this service works correctly:
public string Test() {
Thread.Sleep(58000);
return "test";
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
从问题中尚不清楚问题是发生在模拟器上还是设备上。
如果它发生在模拟器上,您是否具有网络访问权限 - 即您可以从 IE 看到外部站点吗?如果不检查主机上的代理设置,因为 LAN 代理将阻止模拟器通信。
It is not clear from the question if the problem occures on the emulator or the device.
If it is occuring on the emulator do you have network access - i.e. can you see external sites from IE. If not check the proxy settings on your host machine as a LAN proxy will prevent the emulator communicating.
服务器端超时设置为多少?听起来问题可能出在电线的另一端。
What are the server-side timeouts set to? Sounds like the issue may possibly be at the other end of the wire.
我从Windows Phone设备下载了.NET Framework的库并反编译它们。
HttpWebRequest 的超时时间为 1 分钟,不可更改。
为了确认,我创建了一个 aspx 页面。如果我将 Thread.Sleep(60000) 放在 Page_Load 中,HttpWebRequest 将无法获得响应。
I downloaded .NET Framework's libraries from Windows Phone device and decompile they.
HttpWebRequest has unchangeable timeout in 1 minute.
To confirm, I created an aspx page. If I put Thread.Sleep(60000) in Page_Load, HttpWebRequest will not be able to get an response.