Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Services > Asynchronous WCF Service Question

Thread Tools

Asynchronous WCF Service Question

Posts: n/a
I am using WCF Services exposed as REST URIs to be consumed by generic
AJAX clients. All of my services need to be Async in nature.
We have a typical n-layer architecture for our project wherein the
Service Layer --> Business Layer and
Business Layer --> Data Access Layer
Data Access Layer --> LINQ --> DB

The heaviest part of the processing will be fetching and sending
updates to the database. As such this part needs to be made
Earlier, we had thought that the service layer would simply accept the
calls. It would then use ThreadPool.QueueUserWorkItem to spawn a
secondary thread and move the calls to the Business Layer onwards to
this secondary thread. For e.g.

public IAsyncResult BeginGetData(params)
//Create an AsyncResult
ThreadPool.QueueUserWorkItem(SomeCallback, AsyncResult)
//Return AsyncResult

private void SomeCallback(object state)
//Call BUSINESS Layer which calls Data Access Layer and so on.

public string GetData(AsyncResult)

But this defeats the purpose of Async operations since we end up using
threads from the same thread pool as ASP.Net for the WCF services. A
load test confirmed this too. The performance was worse than a
synchronous WCF service call. An article I read on Async HTTP handlers
mentioned the same.

Do I need to split my Business Layer and Data Access Layer methods
into Begin and End pairs too? Or is there a better way.

Kindly let me know, what is the preferred way of handling this as I am
sure that this would be a problem faced commonly.

Thanks in advance
Vikas Manghani
Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Difference between Ajax Enabled WCF service and regular WCF? Cindy Lee ASP .Net 1 03-19-2010 05:59 PM
AJAX enabled WCF Service Vs Standard WCF Service Simon ASP .Net 0 10-13-2009 09:13 AM
Ajax calls web service in wcf(windows service) Billy Zhang ASP .Net 7 07-31-2008 07:37 AM
Web Service versus WCF Service (and Books) kellygreer1 ASP .Net Web Services 1 11-09-2007 12:54 AM
SOAP Header in a Dot Net 2.0 Web Service Client Consuming a WCF 3.0 service. Curt K ASP .Net Web Services 3 06-15-2007 10:19 PM