Reputation: 11360
I have created a very simple WCF service, hosted on windows service, closely following the example on MSDN here: http://msdn.microsoft.com/en-us/library/ff649818.aspx
If I make a 2nd call to my service > 10 mins after my first call, I'll get a inactivity timeout error. I understand that this is the default setting of the WCF client.
However, when I change my app.config from
<reliableSession ordered="true" inactivityTimeout="00:10:00"
enabled="false" />
to
<reliableSession ordered="true" inactivityTimeout="infinite"
enabled="true" />
I get this error when I try to make a call:
The message with Action 'http://schemas.xmlsoap.org/ws/2005/02/rm/CreateSequence' cannot be processed at the receiver, due to a ContractFilter mismatch at the EndpointDispatcher. This may be because of either a contract mismatch (mismatched Actions between sender and receiver) or a binding/security mismatch between the sender and the receiver. Check that sender and receiver have the same contract and the same binding (including security requirements, e.g. Message, Transport, None).
This is how my WCF config file look like on the windows service.
<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>
My question would be, how do I set the inactivityTimeout to inifinte, and circumvent the errors I'm getting?
Upvotes: 4
Views: 16919
Reputation: 1336
I think that you need to set also the receiveTimeout on the binding to infinite. This two properties, receiveTimeout and inactivityTimeout have some dependencies on each other, if you set the inactivityTimeout to a higher value than the receiveTimeout you might get some errors.
For example:
<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>
and put bindingConfiguration="someServiceFederatedBinding" in your service.
Upvotes: 5