Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

ProcessModelSection.MaxWorkerThreads Property

Gets or sets a value indicating the maximum amount of worker threads per CPU in the CLR thread pool.

Namespace: System.Web.Configuration
Assembly: System.Web (in system.web.dll)

public int MaxWorkerThreads { get; set; }
/** @property */
public int get_MaxWorkerThreads ()

/** @property */
public void set_MaxWorkerThreads (int value)

public function get MaxWorkerThreads () : int

public function set MaxWorkerThreads (value : int)

Not applicable.

Property Value

The maximum number of threads. The default is 20.

The value of MaxWorkerThreads must be equal to or greater than the MinFreeThreads setting in the httpRuntime configuration section.

You can have some control over the CPU utilization by setting the number of worker threads and I/O threads, using the MaxWorkerThreads property and, the MaxIOThreads property, respectively.

The difference between the two types of threads is that the latter are bound to I/O objects, such as a stream or a pipe, and the former are traditional unrestricted threads. For Internet Information Services (IIS) version 6.0 and higher, ASP.NET processes requests on worker threads. This is because ASP.NET is integrated within IIS.

These threads are obtained from the process-wide CLR thread pool belonging to an application.

NoteNote:

Usually the default values for the allowed threads are sufficient to keep the CPU utilization high. If for some reason your application is slow, perhaps waiting for external resources, you could try to increase the number of threads to a value less than 100.

The following code example shows how to access the MaxWorkerThreads property.


// Get the current MaxWorkerThreads property value.
int maxWorkerThreads = 
    processModelSection.MaxWorkerThreads;

// Set the MaxWorkerThreads property to 128.
processModelSection.MaxWorkerThreads = 128;


Windows 98, Windows Server 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.