Multithreading in regards to WCF Service and a Web Service

Posted on 2013-10-02
Medium Priority
Last Modified: 2013-10-02
I read the following article indicating the following:
WCF Services can be multi-threaded via Service Behavior class, while web services cannot be multi-threaded.

See article:

My question is how does a Web Service handle multiple request if it isn't multi-threaded?
Does the request invoke new instances of the web service?
Question by:metro156
  • 2
  • 2
LVL 11

Accepted Solution

b_levitt earned 2000 total points
ID: 39541249
I would say the referenced article is incorrect.  As you correctly identified, IIS is certainly "multithreaded" as is a WCF service and there is nothing stopping you from using additional threads in the middle of a call.  I think the article botched the concept of additional concurrency control options that WCF has within a client session via the ConcurrencyMode behavior.

I think this article has the best example:

Author Comment

ID: 39541320
Ok so because the Web Service is hosted by IIS, it can handle multiple request, correct? And the WCF Service can create instances upon a request?

So in essence they both can able to handle Multi-Request without adding coding (Except in the WCF Service modifying the ConcurrencyMode behavior to Multiple?

Here is a very good article on WCF Service on handling request:

LVL 11

Expert Comment

ID: 39541360
Even with the WCF service with ConcurrencyMode=Single, it is still threaded in the same sense that an ASMX service is - requests made by separate clients would be executed on their own worker thread.

Author Comment

ID: 39541813
From reading the article above, it would seem that the data manipulated in the
( ConcurrencyMode=Single- which means one instance of the WCF Service)
WCF  Service is shared by all the clients calling it. In other words multiple threads access the same WCF Service instance.  There must a Lock on the instance when WCF Service is in Single mode.

Do you have an article on how ASMX handles multiple concurrent request? I know ASMX is hosted by the IIS. You are saying it's multi-threaded. In this case do you really mean that the ASMX is instantiated  by every request to it and  that each instance has its own thread?

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
In real business world data are crucial and sometimes data are shared among different information systems. Hence, an agreeable file transfer protocol need to be established.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
To export Lotus Notes to Outlook PST or Exchange and Domino Server files to Exchange Server or PST files with ease, go for Kernel for Lotus Notes to Outlook conversion tool. Through the video, you can watch the conversion process. A common user with…

607 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question