I have a fairly simple WCF web service hosted on IIS Express (ultimately full IIS) using .Net 3.5. The service method is rather uninteresting.
[ServiceContract] public class MySvc { [OperationContract] public Stuff MyMethod(string input) { Stuff result = DoSomething(); return result; } }
The service configuration is also quite general:
<system.serviceModel> <services> <service behaviorConfiguration="MySvcBehavior" name="MySvc"> <endpoint address="" binding="wsHttpBinding" contract="MySvc"> <identity> <dns value="localhost"/> </identity> </endpoint> <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/> </service> </services> <behaviors> <serviceBehaviors> <behavior name="MySvcBehavior"> <serviceMetadata httpGetEnabled="true"/> <serviceDebug includeExceptionDetailInFaults="false"/> </behavior> </serviceBehaviors> </behaviors> </system.serviceModel>
The service is used in code in an ASPX application. There is a service link leading to some equally uninteresting code.
MySvcClient svc = new MySvcClient(); Stuff result = svc.MyMethod("foo");
So far, this is one request at a time, everything works fine, and the client code gets the expected result. Yay
The problem arises when I do very primitive stress testing. I load the ASPX client page into a browser and then hold down the F5 key. Watching the IIS Express window, at first the results are returned as status 200, but after a few minutes I start to see status 500. At this point, the service will only respond with status 500 until I restart IIS Express. (Based on an expectation of about 10 minutes.)
Setting a breakpoint in the client code, I see that the full return message is "There are too many pending secure conversations on the server. Please try again later."
Setting a breakpoint in the server code, I believe that my code is not even called. Thus, it does not work somewhere between the call and the actual start of my code.
My searches on the Internet were not very promising, basically leading to the same suggestion of writing a custom binding to override the maxPendingSessions property and the thread starting with โSomeone told me that there is a [unnamed] configuration file fileโ, which then leads to a broken link claiming that Microsoft recognized this as a mistake.
The maxPendingSessions property link mentions a limit of 128 connections with a timeout of two minutes, and I can, of course, see where my testing method will interrupt some connections. Is this the expected result of an erroneous testing methodology? Or can something be done in the configuration to improve this?