Click here to Skip to main content
15,891,657 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi there,

I am calling a WCF service from a form. Service is hosted in IIS. The service with the following attributes: InstanceContextMode.PerSession, ConcurrencyMode = ConcurrencyMode.Multiple

I have set the throttling behaviour to max out at 2000 for all concurrent calls, instances and sessions.

However I cant seem to get more than 200 sessions concurrently. After that the service just does not respond, and the session eventually times out.

I am using an Asynch call to call the method in the service ie
C#
IASyncResult res= Proxy.BeginMethod(endCall,null);

and then to catch the response I have a endCall function that takes in the IASyncResult and processes the result via EndMethod().

in a load simulation @ 1 method call a second, it all works fine until around 200 calls, and then just waits... (I have 199 or 198 responses from those 200 calls at this point in time)..

Perhaps there is some garbage collection or closing that I am not doing?
any suggestions?
Posted
Updated 17-Sep-11 3:39am
v2

1 solution

Where you place null in your code (the state) you better set Proxy as value.
In the EndMethod you first do:
C#
Proxy myProxy = (Proxy)ar.AsyncState; // assuming ar is declared as IASyncRestult name in method

in that case you do threadsafe asynchronous calls.
 
Share this answer
 
Comments
faroukg 17-Sep-11 10:57am    
so in the EndMethod:

Collapse | Copy Code

{
MyServiceRef.MyServiceClient myProxy = (MyServiceRef.MyServiceClient) callRes.AsyncState;

int res = myProxy.EndMethod(callRes); //callRes is my IASyncResult

}


??
Herman<T>.Instance 17-Sep-11 14:14pm    
correct, that is the threadsafe way!
faroukg 17-Sep-11 14:23pm    
ok tried that..still doesnt solve the problem... still only get to 200 and then the asynch calls just "wait" till timeout
Herman<T>.Instance 18-Sep-11 9:34am    
is your service set up as httpmodule?
faroukg 18-Sep-11 13:42pm    
i am not sure.. where do i see this, and what do i set it to?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900