gpt4 book ai didi

.net - WCF Windows 服务超时

转载 作者:可可西里 更新时间:2023-11-01 12:21:38 25 4
gpt4 key购买 nike

我有一个在 .net 中开发的客户端应用程序向 wcf 服务发出请求并应该发送响应。如果执行时间在 1 分钟内,则没有错误,如果超过1分钟错误是

Inner exception: This request operation sent to net.tcp://localhost:18001/PitToPort/2008/01/30/StockpileService/tcp did not receive a reply within the configured timeout (00:01:00).
The time allotted to this operation may have been a portion of a longer timeout. This may be because the service is still processing the operation or because the service was unable to send a reply message. Please consider increasing the operation timeout (by casting the channel/proxy to IContextChannel and setting the OperationTimeout property) and ensure that the service is able to connect to the client

如何增加超时以及如何?什么是最佳解决方案?

最佳答案

请注意,此错误消息是 WCF 在不知道发生了什么时发送的样板字符串。它的真正意思是“嗯,链中出了点问题,但我不太确定是什么,所以,这里有一些关于配置的琐事,用它做你想做的事”。

大多数时候当您收到此消息时,它与实际超时无关。它可以是配额(图表中的对象数量、总体大小、数组长度)或服务器端出错的东西,在您的服务方法返回结果和通过网络发送实际字节之间。因此,您应该检查您的配置设置(而不是超时,除非您实际上必须等待一分钟才能收到错误。如果您立即收到错误,则它与超时无关)。

这个无用的消息在我的 WCF 烦恼列表中名列前茅。

关于.net - WCF Windows 服务超时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/919287/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com