【发布时间】:2011-04-21 01:43:51
【问题描述】:
我是 wcf 和多线程的新手,我编写了一个托管在 IIS7 中的 wcf 服务,在这个服务中有一个长时间运行的任务 (System.Threading.Tasks.Task),它可能会运行 20 小时.
但是这个 wcf 服务总是每 20 分钟停止一次工作。
当 application_stop 和 application_start 运行时,我让 wcf 向我发送电子邮件。因此,当它开始运行时,我收到一封电子邮件,然后在 20 分钟后,我收到电子邮件显示服务停止。
我真的不明白为什么会发生这种情况,为什么服务每 20 分钟就会停止工作。
wcf 服务是每 20 分钟停止一次,还是 Task 线程每 20 分钟停止一次?
IIS7 的任何配置都会影响 wcf 运行时间吗?
我尝试将 receiveTimeout 设置为一个大的时间量,并使用 asych 调用在客户端调用 wcf,但这没有帮助。
伙计们,我真的需要帮助,非常感谢。
以下代码属于调用此 wcf 服务的网站
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IMailingService" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="24.20:31:23.6470000" sendTimeout="00:01: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="None">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost:92/MailingService.svc" binding="basicHttpBinding"
bindingConfiguration="BasicHttpBinding_IMailingService" contract="MalingService.IMailingService"
name="BasicHttpBinding_IMailingService" />
</client>
</system.serviceModel>
【问题讨论】:
标签: multithreading wcf