This is a migrated thread and some comments may be shown as answers.

Need some help (IIS Hosted WCF, Multiple Async Calls from ASP.NET site)

3 Answers 166 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
James Legan
Top achievements
Rank 1
James Legan asked on 22 Dec 2011, 03:20 PM

All,

I have an odd (I think) issue that I would really appreciate some help on. The nut of the issue is that I have a WCF 4.0 service posted in IIS (ASP.NET).

This WCF service needs to be accessible to protocols other than HTTP and is not in ASP.NET compatibility mode.

One of the components interfacing with this WCF service is in fact an ASP.NET site. On one of the pages there are the following controls:

- 2 timers
- RadTextBox
- div tag which in codebehind is being updated (html content)
- RadGrid
- RadAjaxManager (and all of its necessary components (i.e. loading panel))

1 of the timers is set to tick every 1 second, the other every 10 seconds.

During the 1 second timer tick, if the text has changed in the RadTextBox since the last postback, a call to the WCF service is made and the DIV tag is updated. This call returns immediately.

During the 10 second tick, if the text has changed in the RadTextBox since the last postback, a call to the WCF service is made and the RadGrid is updated. This call returns in ~8 seconds.

The code in the timers utilizes the async proxy generated methods for the WCF service and the callbacks handle the appropraite updating of the respective controls.

All of this is handled with RadAjaxManager (timer 1 updates div tag, timer 2 updates radgrid).

This solution works *except* that in the time during the timer 2 execution when a change is detected (~8 seconds), no further updates happen from the timer 1 code *until* after the callback initiated by the timer 2 code returns.

Essentially something is blocking somewhere. At first I thought it was a timer but then I repro'd the issue by invoking the grid population by a button click. I looked at the WCF service again and its ServiceBehaviors all appear to be set correctly to support proper async operations. About the only thing I haven't done is physically implement my own async methods in the WCF service to see if that resolves it.

Am I missing anything obvious here? Can two different async calls into the same WCF service not occur asynchronously?

Thanks for any and all help.

Jim

3 Answers, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 23 Dec 2011, 07:00 PM
Hi,

To overcome this behavior you can try setting the RadAjaxManager RequestQueueSize property to a value greater than zero, so it handles the multiple requests. Usually only the last request finishes and the previous ones are aborted when the RequestQueueSize is set to 0 (default value). Enabling the queueing mechanism of RadAjax will allow you to complete the ongoing request and then initiate the pending requests in the control queue.

Please give this suggestion a try and let me know if it helps.

All the best,
Pavlina
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
0
James Legan
Top achievements
Rank 1
answered on 23 Dec 2011, 08:32 PM
I do not believe this is what the queuing property does (as I have played with it ad nauseam already). I believe (as proven by my WCF tracing) that *each* individual AJAX event (in this case there are two, one for each timer) supports queueing when the property is set greater than zero.

For example: Timer 1 fires every 1000ms. If it took the WCF call in Timer1_Tick 2000ms to return and queue was set to 2, the first request would not be "dropped" in lieu  of the second request and it would be allowed to finish, unless of course a 3rd request came in before it finished at which point it would be dropped on the floor.

However, this does not magically allow one Aysnc WCF request (rendered with AJAX UpdatePanels via RadAjaxManager to not block while waiting on the other.

Unless I am misunderstanding its implementation or misinterpreting the WCF tracing results I am afraid it is not a simple matter of enabling queuing.

Thanks,

Jim
0
Marin
Telerik team
answered on 27 Dec 2011, 12:53 PM
Hello Jim,

 Indeed this seems like a limitation of the WCF framework. You can try using the TaskFactory.FromAsync method to run the separate Async calls in parallel as shown in this article:
http://blogs.msdn.com/b/endpoint/archive/2010/11/13/simplified-asynchronous-programming-model-in-wcf-with-async-await.aspx 

Hope this helps.

All the best,
Marin
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
Tags
General Discussions
Asked by
James Legan
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
James Legan
Top achievements
Rank 1
Marin
Telerik team
Share this question
or