我创建了一个非常简单的 WCF 服务,托管在 Windows 服务上,紧跟 MSDN 上的示例:http: //msdn.microsoft.com/en-us/library/ff649818.aspx
如果我在第一次呼叫后超过 10 分钟对我的服务进行第二次呼叫,我将收到不活动超时错误。我了解这是 WCF 客户端的默认设置。
但是,当我改变我的 app.config 从
<reliableSession ordered="true" inactivityTimeout="00:10:00"
enabled="false" />
到
<reliableSession ordered="true" inactivityTimeout="infinite"
enabled="true" />
当我尝试拨打电话时出现此错误:
由于 EndpointDispatcher 的 ContractFilter 不匹配,接收方无法处理带有 Action 'http://schemas.xmlsoap.org/ws/2005/02/rm/CreateSequence' 的消息。这可能是因为合约不匹配(发送方和接收方之间的操作不匹配)或发送方和接收方之间的绑定/安全不匹配。检查发送方和接收方是否具有相同的合同和相同的绑定(包括安全要求,例如消息、传输、无)。
这就是我的 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,并规避我遇到的错误?