Hello I have a simple wcf service like this, with a test method which simply sleeps for 20 seconds and returns a value. I wrote a test page which uses jquery to call it 10 times in a row, and it appears to execute concurrently, with the client waiting 20 seconds and then getting results back from all of the services at about the same time.
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
[ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall,ConcurrencyMode=ConcurrencyMode.Multiple,UseSynchronizationContext=false)]
public class AjaxTestWCFService : IAjaxTestWCFService
However if I set
aspNetCompatibilityEnabled="true"
in web.config then no matter what I do, with concurrencymode, usesynchronizationcontext
or instance context mode, or even serviceThrottling
config, it appears to execute each web service call sequentially, with it taking 2 minutes for all 10 requests to return!!
Now I realize that this may be because of session, but at least in ASMX services I was able to set enablesession to false. And in fact my web service method is not using session at all. So you may wonder, why use aspNetCompatibilityEnabled
at all. Because I want to use ASP.net impersonation and forms authentication.
I even set
[ServiceContract(SessionMode=SessionMode.NotAllowed)]
So my question is, is this by design and how can I enable concurrent web service requests with ASP.net compatibility enabled?