WCF服务保持在线状态,长时间闲置状态下不断线解决方案



 
1. WCF服务配置为可靠会话,设置reliableSession。
2. 设置binding的receiveTimeout属性。
3. 将inactivityTimeoutreceiveTimeout属性的超时时间设置相同的数值。建议改为4或8小时(通常上/下午工作时间小于4小时,改为4最理想),下面是Web.Config和App.Config文件的配置。

<binding name="ISalesModuleService" maxBufferPoolSize="524288" maxReceivedMessageSize="2147483647" messageEncoding="Text"  receiveTimeout="04:00:00"  >

 <!--大数据量通信设置-->           <readerQuotas maxDepth="6553600" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="6553600" maxNameTableCharCount="6553600"/>

 <!--可靠会话设置-->           <reliableSession ordered="true" inactivityTimeout="04:00:00" enabled="true" />

</binding>

 转自:http://www.csframework.com/welcome.htm

原文地址:https://www.cnblogs.com/y740504/p/2943633.html