Web 服务不关心 Timeout 属性

发布于 2024-07-11 04:30:05 字数 673 浏览 5 评论 0原文

我正在使用自动创建的(使用 wsdl.exe 和基于 GUI 的“添加 Web 引用”命令)Web 服务 LyricWiki.org。 然而,由于我的互联网连接最近很糟糕,它花了很长时间才能完成,这让我很恼火。

我试图通过使用 .Timeout 属性使其在 2000 毫秒内超时,但它仍然挂起。 我还尝试使用此 页面 中的 CallWithTimeout 函数,但没有成功。 还尝试了命令的异步版本,但我想在上述时间后取消它。

var lw = new LyricWiki();
lw.Timeout = 1000;
LyricsResult result = lw.getSong(artistName, trackName);
// Hangs for a long time...
lyrics = result.lyrics;
lyricsURL = result.url;

有什么建议么? 过去一个小时我一直在 StackOverflow 上搜索,但还没有找到解决方案:(

I'm using an automatically created (with wsdl.exe and the GUI-based "Add web reference" command) web service for LyricWiki.org. However, since my internet connection is sucking lately, it's been taking ages to complete and is annoying me.

I'm trying to make it timeout in 2000ms by using the .Timeout property, but it still hangs. I also tried using the CallWithTimeout function from this page, but no go. Have also tried the async versions of the commands, but I want to cancel it after the mentioned time.

var lw = new LyricWiki();
lw.Timeout = 1000;
LyricsResult result = lw.getSong(artistName, trackName);
// Hangs for a long time...
lyrics = result.lyrics;
lyricsURL = result.url;

Any suggestions? Been scouring StackOverflow for the past hour, but I haven't found a solution yet :(

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

一人独醉 2024-07-18 04:30:05

我相信超时是以秒为单位指定的,而不是毫秒。 至少这是它处理手动创建的 WCF 内容的方式。

I believe the timeout is specified in seconds, not milliseconds. At least that's the way it works with manually-created WCF stuff.

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