Windows Phone 7 一分钟后抛出 EndpointNotFoundException

发布于 2024-12-25 03:38:17 字数 995 浏览 3 评论 0原文

在我的应用程序中调用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

奢华的一滴泪 2025-01-01 03:38:17

从问题中尚不清楚问题是发生在模拟器上还是设备上。
如果它发生在模拟器上,您是否具有网络访问权限 - 即您可以从 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.

我爱人 2025-01-01 03:38:17

服务器端超时设置为多少?听起来问题可能出在电线的另一端。

What are the server-side timeouts set to? Sounds like the issue may possibly be at the other end of the wire.

春花秋月 2025-01-01 03:38:17

我从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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文