Professional Documents
Culture Documents
IIS
IIS
An Application Pool can contain one or more applications and allows us to configure a level of isolation
between different Web applications. For example, if you want to isolate all the Web applications running
in the same computer, you can do this by creating a separate application pool for every Web application
and placing them in their corresponding application pool. Because each application pool runs in its own
worker process, errors in one application pool will not affect the applications running in other application
pools. Deploying applications in application pools is a primary advantage of running IIS 6.0 in worker
process isolation mode because you can customize the application pools to achieve the degree of
application isolation that you need.
When you configure application pools for optimum availability, you also should consider how to configure
application pools for application security. For example, you might need to create separate application
pools for applications that require a high level of security, while allowing applications that require a lower
level of security to share the same application pool. In the later part of this article, we will see how to
configure identities at the application pool level.
When creating a new application, you also have the option of inheriting the settings from an existing
application pool. For example, if you want your new application pool to inherit the settings from
the DefaultAppPool, you can do that by selecting the option Use existing application pool as
a template in the above screen. After you pick this option, the Application Pool name dropdown box
will be enabled from where you can select an existing application pool.
After the pool is created, you can save the settings of the application pool to an external XML file any time
by right-clicking the application pool and selecting the option All Tasks->Save Configuration to
a File that is available from the context menu. This is an extremely useful feature that makes it possible
for you to easily recreate the same application pool on the same server or on a different server with
minimal effort.
NetworkService
LocalSystem
LocalService
To configure identity for an application pool, right-click the application pool and select Properties from
the context menu. In the Properties dialog box, select the Identity tab and you will see the following
screen.
In the above dialog box, when you select the Predefined option, you can select any of the pre-defined
accounts from the dropdown box. Instead of using a pre-defined account, if you want your application
pool to run under a different account, select the Configurable option and then set the User
name and Password in the textboxes. This approach is particularly useful especially when you are
running multiple applications or sites on one Web server. For example, if an ISP hosts two companies—
who may even be competitors—on one Web server, it has to guarantee that these two applications run in
isolation from each other. More importantly, the ISP has to make sure that a malicious administrator for
one application can't access the data of the other application. You can accomplish this level of isolation
by using the configurable worker process identity.
Now, let us add the following lines of code to the Page_Load event of the default Web form
WebForm1.aspx.
As you can see from the above code, we simply display the name of the account that the ASP.NET Web
application uses to process the service. If you execute thise code by navigating to the page from the
browser, you will see the following output.
Post a comment
Email Article
Print Article
The above output just reinforces the fact that, by default, the Web application runs using
the NetworkService account. Let us change the identity of the DefaultAppPool and then look at the
output of our Web application. To do this, right-click the DefaultAppPool node from the IIS manager
and select Properties from the context menu. In the properties dialog box, navigate to
the Identity tab and select the Configurable option and specify a valid user name and password.
Once entered, the screen should look like the following.
Now if you execute your application, you will see the following output.
As expected, the output reflects the change that we made using the IIS manager.
After creating the new project, if you open up IIS Manager, you will find that the IISIntegration project is
created under an application pool named DefaultAppPool. As the name suggests, by default, all the newly
created ASP.NET Web applications are created under this application pool. This is shown in the following
screen shot.
Click here for a larger image.
To associate the IISIntegration ASP.NET Web application with the application pool
named DemoAppPool, select the Web Sites node that is present under the Machine Name node in the
IIS manager. Then, select Default Web Site-&IISIntegration from the treeview and right-click it
to select Properties from the context menu.
In the Properties dialog box shown above, you can change the Application Pool using the Application
Pool dropdown option in the Directory tab. Because we want our Web application to run under
the DemoAppPool, select DemoAppPool from the list.
To configure all the above settings, go to the Properties window of the application pool in which your Web
application is running using the IIS manager. Using the Recycling, Performance, and Health tabs in the
Properties window, you can specify values for the above settings. Navigating to the Performancetab in
the Properties dialog box of the DemoAppPool results in the following output.
When you set the recycling of worker processes using IIS manager, you also need to take the state
management strategy of your ASP.NET application into consideration. Because every time the worker
process is recycled, the ASP.NET state information will be lost rendering the application in an invalid
state. One alternative to overcome this issue is to maintain state data external to the worker process,
such as in a database. However, moving data to an external database to allow recycling can affect server
performance in the following two ways:
Performance is reduced because of the added data management that is needed to move the data
between the application and the database.
Recycling flushes any in-process data caches, so the caches need to be rebuilt.
If you have an application pool with applications that depend on state data, you must decide whether or
not to recycle the worker processes that are assigned to that application pool. If you store state in the
same process as that of IIS, and you don't want the state information to be lost, you must not recycle a
worker process using the application pool configuration settings.
Conclusion
In this part, we looked at what application pools are and their role in increasing the reliability of your
ASP.NET Web applications. We also understood that by allowing different ASP.NET applications to run
under their own application pool, we can also set different identities, thereby controlling the security
permissions for different ASP.NET Web applications. In Part-3 of this article, we will discuss the new
XML-based Metabase storage and the security features of IIS 6.0.
An IIS Worker Process (w3wp.exe) handles the web requests sent to the IIS web
server for the configured IIS application pool.
IIS application pools also provide a bunch of advanced settings. These impact the
behavior of w3wp and your IIS worker process. Including things like what Windows user
account it runs as, auto restarting of the process, auto shutdown, and more. It is also
possible for one IIS application pool to create multiple IIS worker processes in what is
called a web garden.
How to View Running IIS Worker Processes (w3wp.exe)
Via the Windows Task Manager, you can see processes named w3wp.exe. Within the
IIS management console, you can view more details. Open IIS manager and on the left
side click on the name of your computer. You will then see a similar list of icons on the
right as shown in the screenshot below. Double click on “Worker Processes” and you
can get a list of which processes are currently running.
On the Worker Processes screen, you can see more details than you would be able to
see from Windows Task Manager. You can easily see the name of the IIS application
pool and the Process Id for the running w3wp.exe process.
If you want to go even a step further, you can double click on a worker process to see
which web requests are currently executing within your IIS worker process.
If you want to shut down the IIS web server completely, you will want to stop the
Windows Service called “World Wide Web Publish Service.” Be sure to stop it and then
modify the “Startup type” to Disabled. If you do not disable it, it will start back up when
you restart Windows.
Instead of disabling IIS altogether, you can stop individual IIS application pools within
the IIS management console.
Monitoring IIS Worker Processes & ASP.NET Applications
If you have critical ASP.NET web applications running on your web server, it is
important to monitor your server, IIS, and applications. It is important to know if
w3wp.exe stops running, your server goes down, or if your application is running slow.
If you need help monitoring the performance of your ASP.NET applications, be sure to
check out our .NET application performance monitoring solution, Retrace. Retrace can
monitor key Windows performance counters and the performance of your application all
the way down to the code level. Including slow SQL queries, application errors, and
much more.
1. ) Manager. (Run->inetmgr)
2. In the left pane, expand the local computer and then select Application Pools.
3. Right-click the Application Pools node, clicks Add Application Pool, and then clicks Application Pool.
4. In the Add Application Pool dialog box, type “Pool Name” in the name text box. In figure Pool name
isBluechipplus. Select .NET Framework version. In figure, I select 4.0.30319. Select Managed pipeline
mode. I select integrated mode. Selection of framework version and managed pipeline mode depends on
your application which you are going to hosted. Click OK to complete application pool creation.
5. Now select application pools. You will see newly created Bluechipplus application pool in the middle
panel.
Step 6: Configure application pool
1. Select newly created “Bluechipplus” application pool in the middle panel.
1. Click Advanced Settings in “Edit Application Pool” section in the right panel. A dialogue box will appear
named “Advanced Settings”
2. In Process Model section, select identity. Network service is default and recommended. If you find
problem, you should change. In figure Local service is selected.
3. In Process Model section, type maximum worker process. In figure 12 maximum worker processes
selected. Selecting worker process is actually depends on your server capability and memory.
4. In Recycling section, select private memory limit in KB. In figure 200000is selected. Consider your server
memory before considering memory limit.
5. Finally click OK to complete application pool settings.
Step 7: Select application pool for the application
1. Right click on application in IIS->Manage Application -> Advanced Settings
2. From advanced settings dialogue box -> Browse application pool -> Select application pool
3. Finally click OK after assigning application pool
"The "Process" which is responsible for processing Asp.net application request and sending back
response to the client , is known as "Worker Process". All ASP.NET functionalities runs within the
scope of this process."
"Process which is responsible for all asp.net requests and response cycle is known as worker
process."
Each server in the group of servers handles a separate ASP.NET worker process.
Each CPU in the SMP server handles a separate ASP.NET worker process.
ISAPI is the first and highest performance entry point into IIS for custom Web Request handling
ISAPI (Internet Server Application Program Interface) is a set of Windows program (APIs (DLL))
calls that let you write a Web server application that will run faster than a common gateway interface
(CGI) application.
When the first ASP.NET request comes in the DLL will spawn a new process in another EXE –
aspnet_wp.exe/w3wp.exe – and route processing to this spawned process. This process in turn
loads and hosts the .NET runtime. Every request that comes into the ISAPI DLL then routes to this
worker process via Named Pipe calls.
A request starts on the browser where the user types in a URL, clicks on a hyperlink or submits an
HTML form. Or a client application might make call against an ASP.NET based Web Service, which
is also serviced by ASP.NET. On the server side the Web Server IIS picks up the request. At the
lowest level ASP.NET interfaces with IIS through an ISAPI extension.
In IIS .aspx is mapped through an 'Application Extension' (aka. as a script map) that is mapped to
the ASP.NET ISAPI dll - aspnet_isapi.dll. Every request that fires ASP.NET must go through an
extension that is registered and points at aspnet_isapi.dll.
ISAPI is very low level it also is very fast, but fairly unmanageable for application level development.
So, ISAPI has been mainly relegated for some time to providing bridge interfaces to other application
or platforms. But ISAPI isn't dead by any means. In fact, ASP.NET on Microsoft platforms interfaces
with IIS through an ISAPI extension that hosts .NET and through it the ASP.NET runtime. ISAPI
provides the core interface from the Web Server and ASP.NET uses the unmanaged ISAPI code to
retrieve input and send output back to the client. The content that ISAPI provides is available via
common objects like HttpRequest and HttpResponse that expose the unmanaged data as managed
objects with a nice and accessible interface.
To host Web sites, you must have an Internet server that supports the Hypertext Transfer Protocol
(HTTP). If you have chosen an ISAPI-compliant Web server (for example, Microsoft Internet
Information Server), you can take advantage of server extension DLLs to create small, fast Internet
server applications.
A special kind of ISAPI DLL is called an ISAPI filter, which can be designated to receive control for
every HTTP request. You can create an ISAPI filter for encryption or decryption, for logging, for
request screening, or for other purposes.
ISAPI consists of two components: Extensions and Filters. These are the only two types of
application that can be developed using ISAPI.
Extensions
ISAPI Extensions are true applications that run on IIS. They have access to all of the functionality
provided by IIS. ISAPI extensions are implemented as DLLs that are loaded into a process that is
controlled by IIS. Clients can access ISAPI extensions in the same way they access a static HTML
page.
Filters
ISAPI filters are used to modify or enhance the functionality provided by IIS. They always run on an
IIS server and filter every request until they find one they need to process. Filters can be
programmed to examine and modify both incoming and outgoing streams of data.
Filters are implemented as DLL files and can be registered on an IIS server on a site level or a
global level (i.e., apply to all sites on an IIS server). Filters are initialized when the worker process is
started and listens to all requests to the site on which it is installed.
Example
Following are the main Server side scripting languages which support ISAPI.
ASP
ASP.NET
Perl
PHP