C# WCF非活动超时

C# WCF非活动超时,c#,.net,wcf,app-config,C#,.net,Wcf,App Config,我已经创建了一个非常简单的WCF服务,托管在windows服务上,并严格遵循MSDN上的示例: 如果我在第一次呼叫后>10分钟再次呼叫我的服务,我将收到一个不活动超时错误。我知道这是WCF客户端的默认设置 但是,当我从 <reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false" /> 到 我在尝试拨打电话时出现以下错误: 信息与行动 'htt

我已经创建了一个非常简单的WCF服务,托管在windows服务上,并严格遵循MSDN上的示例:

如果我在第一次呼叫后>10分钟再次呼叫我的服务,我将收到一个不活动超时错误。我知道这是WCF客户端的默认设置

但是,当我从

 <reliableSession ordered="true" inactivityTimeout="00:10:00"
                   enabled="false" />


我在尝试拨打电话时出现以下错误:

信息与行动 'http://schemas.xmlsoap.org/ws/2005/02/rm/CreateSequence"不可能 由于接收器处的ContractFilter不匹配,在接收器处处理 端点调度器。这可能是因为合同不匹配 (发送方和接收方之间的操作不匹配)或绑定/安全 发送方和接收方之间不匹配。检查发送者和 接收方具有相同的合同和相同的约束力(包括 安全要求,例如消息、传输、无)

这就是我的WCF配置文件在windows服务上的外观

  <system.serviceModel>
<services>
  <service name="Asis.IBSS.Milestone.WCFService.ServiceImplementation.VideoService">
    <endpoint address="" binding="netTcpBinding" bindingConfiguration="" contract="Asis.IBSS.Milestone.WCFService.ServiceContract.IVideoService">
      <identity>
        <dns value="localhost"/>
      </identity>
    </endpoint>
    <endpoint address="mex" binding="mexTcpBinding" bindingConfiguration="" contract="IMetadataExchange"/>
    <host>
      <baseAddresses>
        <add baseAddress="net.tcp://localhost:8555/MilestoneService"/>
      </baseAddresses>
    </host>
  </service>
</services>
<behaviors>
  <serviceBehaviors>
    <behavior name="">
      <serviceMetadata httpGetEnabled="false"/>
      <serviceDebug includeExceptionDetailInFaults="false"/>
    </behavior>
  </serviceBehaviors>
</behaviors>


我的问题是,如何将inactivityTimeout设置为inifinte,并避免出现错误?

我认为还需要将绑定上的receiveTimeout设置为infinite。这两个属性receiveTimeout和inactivityTimeout彼此之间存在一些依赖关系,如果将inactivityTimeout设置为高于receiveTimeout的值,则可能会出现一些错误

例如:

        <bindings>
        <wsFederationHttpBinding>
    <binding name="someServiceFederatedBinding" maxReceivedMessageSize="2147483647" closeTimeout="00:01:00"
                openTimeout="00:01:00" receiveTimeout="infinite" sendTimeout="01:00:00">
      <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="2147483647" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
    </binding>
        </wsFederationHttpBinding>
    </bindings>


并将bindingConfiguration=“someServiceFederatedBinding”放入您的服务中。

我仍然需要NetTcpBinding.OK-但如果您不需要,请不要启用
reliableSession
。我将尝试添加一个名称。是的,两者都设置为无穷大。
        <bindings>
        <wsFederationHttpBinding>
    <binding name="someServiceFederatedBinding" maxReceivedMessageSize="2147483647" closeTimeout="00:01:00"
                openTimeout="00:01:00" receiveTimeout="infinite" sendTimeout="01:00:00">
      <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="2147483647" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
    </binding>
        </wsFederationHttpBinding>
    </bindings>