gpt4 book ai didi

WCF 超时未得到遵守

转载 作者:行者123 更新时间:2023-12-04 19:35:26 24 4
gpt4 key购买 nike

我是一个广泛使用 WCF 的项目的新手,我对 WCF 的经验并不丰富。我正在尝试追踪一个问题,即我的 UI 在等待长时间运行的服务调用返回时 10 分钟后出现超时错误。非常粗略地这是我的项目所需要的:

[service A] <=> [service B] <=> [UI console]

这是我迄今为止收集到的:
  • 超时发生在 serviceA 和 serviceB 之间,而不是在 serviceB 和 UI 控制台之间,因为我实际上有两个单独的 UI 控制台:一个是 MMC 管理单元,一个是 PowerShell 管理单元,两者都表现出相同的 10 分钟超时.
  • 我在 serviceA 和 serviceB 中的端点都使用 basicHttpBinding;两者都有 bindingConfigurations 指定 sendTimeout 和 receiveTimeout 为 30 分钟,而不是 10 分钟。
  • ReliableSession.InactivityTimeout 默认为我读过的 10 分钟,但我不相信其中任何一个都是 ReliableSession,因此它不适用。
  • 我为 WCF 跟踪检测了 serviceB; ServiceTraceViewer 显示了在长时间运行的服务调用开始之前的适当事件,然后在 10 分钟超时之前没有任何内容。

  • 随时就我的任何断言挑战我和/或让我知道我还能做些什么来诊断这个问题。

    2013.04.04 更新

    这是实际的错误消息:

    The request channel timed out while waiting for a reply after 00:09:59.9839984. Increase the timeout value passed to the call to Request or increase the SendTimeout value on the Binding. The time allotted to this operation may have been a portion of a longer timeout.

    Server stack trace: at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout) at System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message, TimeSpan timeout) at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout) at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation) at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

    Exception rethrown at [0]: at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg) at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type) at NextIT.ActiveAdministration.DataContracts.IActiveAdministration.PublishAgentSettings() at ...



    内部异常:

    The HTTP request to 'http://localhost/MyAdminService/' has exceeded the allotted timeout of 00:10:00. The time allotted to this operation may have been a portion of a longer timeout.

    at System.ServiceModel.Channels.HttpChannelUtilities.ProcessGetResponseWebException(WebException webException, HttpWebRequest request, HttpAbortReason abortReason)
    at System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout) at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout)

    最佳答案

    有一句古老的格言“如果它不起作用,请尝试插入它”。我非常专注于在 app.config 文件的痛苦曲折中前行,该文件充斥着大火和困惑——部分原因是在这个大型项目中实际上有 5 个 app.config 文件具有各种绑定(bind)和服务(!)--我没有注意到代码覆盖配置文件的明显部分:

    binding.ReceiveTimeout = new TimeSpan(0, 0, 10, 0);
    binding.SendTimeout = new TimeSpan(0, 0, 10, 0);

    叹。

    但是等等——还有更多。我最初对为什么配置文件中的 30 分钟值没有效果,因为超时发生在 10 分钟而摸不着头脑?好吧,事实证明,10 分钟超时(如上所示在代码中设置)是从 UI 控制台到 serviceB。配置文件中设置的 30 分钟超时是从 serviceB 到 serviceA,所以我不得不将两者都打开,以便让长时间运行的操作继续进行。

    关于WCF 超时未得到遵守,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15775687/

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