Quantcast
Channel: General
Viewing all articles
Browse latest Browse all 7363

How to process max one concurrent request per worker process

$
0
0

Hello,

Say I have the following sample application:

using System.Web.Services;
namespace DoNotShareStatics {
	[WebService(Namespace = "http://tempuri.org/")]
	[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
	[System.ComponentModel.ToolboxItem(false)]
	public class Service1 : System.Web.Services.WebService {
		static bool isRunning = false;

		[WebMethod]
		public string Test() {
			if (isRunning) {
				return "D'OH";
			} else {
				isRunning = true;
				System.Threading.Thread.Sleep(10000);
				isRunning = false;

				return "Whoohoo!";
}	}	}	 }

Of course it is adviced agains using the static variable, but the Thread.Sleep represents a stateful legacy MFC application in my organization which does use static variables, and which cannot be rewritten. So for the sake of example, the given abstraction is how it is.

What I want is to configure IIS such that it reponds "Whoohoo!" on every request (and never "D'OH").

How can I configure IIS such that each worker process handles at most 1 request at a time (and is available again for new requests after the previous one is handled), and IIS handles the queuing/balancing of requests?

Say I have a single application pool with 4 worker processes. I do get the wanted behaviour when I set the Request Limit to 1 and Disable Overlapped Recycle to true. However, I do not want to recycle the worker process after each request, so the Request Limit to 1 is not an option.


Viewing all articles
Browse latest Browse all 7363

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>