【问题标题】:WCF throws error intermittently for the first time whenever I access if after a long time很长一段时间后,每当我访问时,WCF 第一次间歇性地抛出错误
【发布时间】:2015-09-08 05:36:40
【问题描述】:

每当我在一天中第一次访问服务时或长时间访问服务时,WCF 都会间歇性地抛出以下错误。

“服务器没有提供有意义的回复;这可能是由于合同不匹配、会话过早关闭或内部服务器错误造成的。”

否则,它在任何情况下都可以正常工作。我无法理解为什么会发生此错误? P.s:我参考了许多线程并尝试了配置更改,检查了代理不匹配,但没有一个对我有用。 请指导我,否则我必须在服务中添加重试选项

更新
客户端配置

<endpoint address="xxxxx" binding="basicHttpBinding" bindingConfiguration="Binding1" contract="IService" name="BasicEndPoint" />

<binding name="Binding1" maxReceivedMessageSize="99999999"
closeTimeout="00:05:00" openTimeout="00:05:00"
sendTimeout="00:05:00" receiveTimeout="00:05:00" >
          <readerQuotas maxStringContentLength="99999999" />
          <security mode="TransportCredentialOnly">
          <transport clientCredentialType="Ntlm"/>
        <message clientCredentialType="UserName" algorithmSuite="Default"/>
      </security>
    </binding>
  </basicHttpBinding>
</bindings>


<binding name="BasicEndPoint" closeTimeout="00:03:00" openTimeout="00:03:00"
                receiveTimeout="00:10:00" sendTimeout="00:03:00" allowCookies="false"
                bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
                maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
                messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
                useDefaultWebProxy="true">
      <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
          maxBytesPerRead="4096" maxNameTableCharCount="16384" />
      <security mode="Transport">
        <transport clientCredentialType="Windows" proxyCredentialType="None"
            realm="" />
        <message clientCredentialType="UserName" algorithmSuite="Default" />
      </security>
    </binding>

服务配置:

 <binding name="Binding1" maxReceivedMessageSize="99999999">
      <readerQuotas maxStringContentLength="99999999" />
      <security mode="None">
      </security>
    </binding>

【问题讨论】:

  • 您如何托管您的 WCF 以及您使用哪种竞价方式?
  • 我在 IIS 上托管 WCF 服务
  • @TeisLindemark 我已经为您更新了问题。我再次尝试了几乎所有在不同线程中提供的绑定设置,但对我不起作用

标签: c# wcf


【解决方案1】:

好吧,在我使用 WCF 服务期间,我收到了很多奇怪的错误消息。我从中学到的是,它们并不总是那么有意义。

话虽如此,当您描述您的问题时,这听起来像是我使用过的使用命名管道的 WCF 服务之一遇到的一个问题。那是与激活有关的问题。然后我不得不在浏览器中刷新服务地址然后它工作正常。解决它是一个权限问题。

另一个一直给我带来错误消息的事情是,服务的命名空间和合同在 web.config 中是正确的。

当我在谷歌上搜索您的错误消息时,似乎有些人在服务中遇到了枚举问题。我不认为这是你的问题,但也许...WCF catches exception " The server did not provide a meaningful reply.."

【讨论】:

  • 在我的情况下没有枚举。尚未检查命名空间和合同,但似乎是其他问题。
猜你喜欢
  • 1970-01-01
  • 2023-04-03
  • 2010-11-17
  • 1970-01-01
  • 2018-12-29
  • 2019-04-15
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多