简体   繁体   English

WCF服务意外停止的工作流

[英]Workflow as WCF Service Unexpectedly stops

We have a .Net 3.5 Workflow hosted as a service that sometimes stops unexpectedly. 我们有一个.Net 3.5工作流作为服务托管,有时会意外停止。 This has occurred at times while it is writing a file and, most recently, when receiving a reply from another WCF service. 这是在它正在写入文件时发生的,最近一次是在从另一个WCF服务接收到答复时发生的。 There are no exceptions being caught, as these all get logged, and there are no messages in the event logs on the server where both are hosted. 不会捕获任何异常,因为所有异常都会被记录,并且托管这两者的服务器上的事件日志中也没有消息。 I added logging to verify that the service is completing it's logic, which it is (taking about 6 minutes). 我添加了日志记录以验证服务是否已完成它的逻辑(大约需要6分钟)。 All my timeouts are far higher than they need be. 我所有的超时都远远超过了需要。 I'm starting to think the issue might be that the channel is getting closed and, due to the very high timeouts, an error is not yet thrown. 我开始认为问题可能是该频道即将关闭,并且由于超时时间过长,尚未引发错误。 Of potential relevance, the workflow is calling the wcf service asynchronously and then using a WaitOne() on the AsyncWaitHandle. 具有潜在意义的工作流正在异步调用wcf服务,然后在AsyncWaitHandle上使用WaitOne()。 I have a feeling this is maybe not the best idea, but I'm not sure if it could cause this issue. 我觉得这可能不是最好的主意,但是我不确定是否会导致此问题。 Also, persistence is not set up on the workflow (I had previously thought that the unloadOnIdle setting might have been causing issues with getting return values from the called service, as I'm not very clear on how this is supposed to work). 另外,在工作流上未设置持久性(我以前曾认为unloadOnIdle设置可能会导致从被调用的服务获取返回值时出现问题,因为我不清楚该如何工作)。

Any help/advice would be greatly appreciated. 任何帮助/建议将不胜感激。

Have you checked the timeout settings on the client. 您是否在客户端上检查了超时设置。 I know in the past I had to update both the client timeout settings as well as the server settings. 我知道过去我必须同时更新客户端超时设置和服务器设置。

In the workflow App.config (missing a timeout for the hosting of the workflow?): 在工作流App.config中(是否缺少用于托管工作流的超时?):

<bindings>
  <basicHttpBinding>
    <binding name="BasicHttpBinding_IService" closeTimeout="00:02:00"
      openTimeout="00:02:00" receiveTimeout="04:00:00" sendTimeout="04:00:00"
      allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
      maxBufferSize="655360000" maxBufferPoolSize="2147483647" maxReceivedMessageSize="655360000"
      messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
      useDefaultWebProxy="true">
      <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
        maxBytesPerRead="4096" maxNameTableCharCount="16384" />
      <security mode="None">
        <transport clientCredentialType="None" proxyCredentialType="None"
          realm="" />
        <message clientCredentialType="UserName" algorithmSuite="Default" />
      </security>
    </binding>
  </basicHttpBinding>
</bindings>
<client>
  <endpoint address="http://url/Service.svc"
    binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IService"
    contract="DALService.IService" name="BasicHttpBinding_IService" />
</client>

In the DalService WCF web.config: 在DalService WCF web.config中:

<httpRuntime
    maxRequestLength="1048576"
    executionTimeout="6000000"
/>
<basicHttpBinding>
<binding name ="LargeMessageBinding"
          closeTimeout="00:01:00"
          openTimeout="00:01:00" receiveTimeout="04:30:00" sendTimeout="04:30:00"
          allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
          maxBufferSize="655360000" maxBufferPoolSize="524288" maxReceivedMessageSize="655360000"
          messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
          useDefaultWebProxy="true"
         />
<!--maxReceivedMessageSize="6553600" -->
<!--maxBufferSize="6553600" -->

Turns out, the workflow was not being hosted in its own worker process, as I had thought. 原来,工作流没有像我想的那样托管在自己的工作进程中。 Another app was crashing the process. 另一个应用程序崩溃了。 The WCF service was correctly configured to use its own worker process, hence it would correctly return, but to a no longer running app. WCF服务已正确配置为使用其自己的工作进程,因此它将正确返回,但不再运行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM