I've got a WCF service with the instance context mode set to PerCall, and using the wsHttpBinding. A poorly coded client has the ability to consume sessions without properly releasing them (ie the client doesn't call Close() on the client proxy). By looking at the "Percent of Max Concurrent Sessions" performance counter, I can see that each connection uses up a session, and doesn't release it. Under normal, well-behaved circumstances, the session is only used for a few moments while the results of the call are returned.
I've been trying to find a way to get these bad sessions to timeout and go away, but have been unsuccessful. Since it's not a reliable session, the RecieveTimeout and InactivityTimeout settings do not appear to have any effect. Here's a portion of my current config, which has a number of timeouts set in it, but does not seem to work:
<behaviors>
<serviceBehaviors>
<behavior name="UpdaterBehavior">
<serviceMetadata httpGetEnabled="true"/>
<serviceCredentials>
<userNameAuthentication userNamePasswordValidationMode="MembershipProvider"/>
<serviceCertificate findValue="xxxxxx" x509FindType="FindBySubjectName"/>
</serviceCredentials>
<serviceAuthorization principalPermissionMode="UseAspNetRoles" roleProviderName="SqlRoleProvider"/>
<serviceThrottling maxConcurrentCalls="10" maxConcurrentSessions="10" maxConcurrentInstances="10" />
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<wsHttpBinding>
<binding name="UpdaterBinding" messageEncoding="Mtom" maxReceivedMessageSize="100000000" closeTimeout="00:01:00" openTimeout="00:01:00"
receiveTimeout="00:01:00" sendTimeout="00:01:00">
<reliableSession ordered="true" inactivityTimeout="00:01:00"
enabled="false" />
<readerQuotas maxArrayLength="100000000"/>
<security>
<message clientCredentialType="UserName"/>
</security>
</binding>
</wsHttpBinding>
</bindings>
I can set the serviceThrottling numbers much higher, but that just hides the problem for a while, and eventually a bad client would use all the sessions up. I want the server to free up any session that's been around for more than a few minutes, since there's no reason anything on this service should take that long.
Any suggestions?