You will learn followings:
- What is IIS?
- Application Pool in IIS
- IIS App Pool Settings
- How to enable Application Pool recycle logging
- Manage IIS Server Memory Usage
- How to find Worker Process and PID in App Pool
- How to check App pool is 32 bit or 64 bit.
- How to enable 32-bit applications on IIS
What is IIS?
In this article we’ll cover what is IIS (Internet Information Service)? After reading this article you will be able to know the following questions:
What is IIS?
IIS means Internet Information Services and it can be found on window operating system only. It is a web server where we can host our web applications. It supports various technologies such as ASP, ASP.NET and PHP and Angular and static HTML pages too.
How IIS works?
As we discussed above, IIS support various technologies, and we can host all these technologies web sites on IIS. Data on the IIS server is exchanged using HTTP (Hypertext Transfer Protocol) and it can be with or without SSL (Secure Sockets Layer). SSL basically use certificate and transfer the data in encrypted mode and enhance application security. When final rendering of the page is done, HTML is used to display the required content. Basically, our browsers contain multiple engines and HTML engine helps in rendering the HTML page for end user. We can also create FTP on IIS (File transfer protocol) and same is used for download/ upload of files on the server.
Which default user is used by IIS?
In case of "Anonymous authentication" "IUSR_YourMachineName" user account is used as the default identity and IIS_IUSRS is used for group of IIS users. Anonymous authentication is used by FTP/FTPS and HTTP/HTTPS too.
You can set the required permissions for IUSR or IIS_IUSRS as shown in the below image.
Key actions of Application pools
Application pools is an important part of IIS. If we say it is the heart and soul of IIS, then it will not be false. Every hosted application should have separate APP Pool for its better functionality. Ther are ton of App pool settings which help us in managing the application in better way. Following are the important settings of app pool.
- You can limit memory and CPU usages for the given App pool.
- You can assign one or more worker process to the given application pool.
- You can run application pool under the significance of another user (Impersonation).
- You can set 32- or 64-bit application pool as per the project needs.
- You can set app pool recycling process. Either by Time/ number of requests or by memory usages.
How many sites can IIS handle?
A single IIS web server can serve can handle hundreds of websites on it. Moreover, it also depends upon the hardware configuration of that web server like cores of processor and installed/available memory on this server.
How to install IIS on windows
Note: Type inetmgr command in run window, if it opens IIS window then it already exists on your machine else you need to install it using following Steps
Detailed Steps to install and configure IIS.
To install the IIS on the server running on the Microsoft Windows, please follow the following given instructions.
These are the following instruction to install IIS (Internet Information Services):
1. First of all, open the control panel by searching it in window's run.
2. Look for option "Programs and Features" and click on it.
3) On click of "Programs and Features" following window will open.
- Click on “Turn Window feature on or off” link given in above screen. Now you’ll see the following screen from where you can install IIS on your machine.
Select the “Internet information Services” option given in above screen. It will install the default options of IIS. You can also choose the required options to install and then click on OK. Please be sure your machine is internet connected so that it can download the required files if required. Once installation will complete run “inetmgr” command in RUN window (as given in point 1). Now IIS window will open to you.
In next article we’ll discuss importance and “Role of App Pool” in IIS and also discuss its various configuration options which will help you while hosting website on IIS.
We hope with this article you'll get clarity on IIS and its installation process. You can also check on Application Pool Identities.
Application Pool in IIS
In this article we’ll explain you about Application Pool in IIS and its role. If you have not checked our previous articles on IIS, then please check out "What is IIS" before proceeding with current one. After reading this article you will be able to know the following questions:
What is Application pool in IIS?
Application pools form an important part of an IIS. We can say it as a heart and soul of IIS server. It contains various settings which helps us in managing and serving applications in better way.
What is Role of Application Pool in IIS?
“Application pool “plays very important role in web site hosting. Ideally you should create separate app pool for each web site instead of using the existing one or default app pool. Separate app pool will help you configuring it as per your needs, and ultimately your application will run faster and smoother. If you will use the common App pool shared with other website too and if any website is doing memory leaks or doing heavy calculation, then there are maximum chances that current application will use more CPU and memory, and which ultimately kill the performance of your website because they are sharing the common app pool and same worker process.
Below in this article we’ll explain key settings which you can do in “Application pool” so that your application can run in faster and in better way.
Note: Type inetmgr command in RUN window, if it opens IIS window then it already exists on your machine else you need to install it using the steps given in above article HERE.
- Please run “inetmgr” command in RUN window to open IIS. If command did not work, please install it using article (Guide to Install IIS on window).
How to add Application pool in IIS?
Right click on “Application pool” and select “Add Application Pool” as shown in below given screen shot.
Now you can give appropriate name to your application pool and can select the CLR version as per your need is and click OK button. Please note it is CLR version not Dot net version. If you are not sure select anyone it can be changed later on using advanced setting options. We’ll discuss “advanced setting options” later in some other article (App pool advance settings).
Next you can also select “Managed pipeline Mode” as given below. Earlier IIS 6 versions only Classic mode was there and in later versions “integrated mode” was introduced.
Next you can open the ”Advance settings” option (from point no-1 link) and can make the required changes in the “App pool” settings.
- After configurations update, please do not forgot to assign this new application pool to your website. Right click on website and select the “Advance setting option” as shown below.
Where can we change application pool?
In below window you can see "Application Pool" option. Click on three dots on right side (as appearing below) a window will open where you can change Application pool and can select the desired one as per the need.
How to Control CPU usages in application pool?
CPU limit percentage - Under this option we can restrict the CPU usage that specific Application pool can use. 0 or 100 means 100% CPU can be used but we can give percentage here like 50. Using this CPU usage will not go above the defined limits.
When CPU usages will approach threshold value or go beyond specified limit, we can set some action from "Limit Action" option which is just below Limit (Percent).
How to Control memory usages in application pool?
Under application Pool's advanced settings there is one option named Recycling which can be used to manage the memory usage of specific Application pool. You can apply Recycling Settings on required worker processes and once it will hit that limit, a new worker process for the same pool will be created that it will take care of executing all incoming requests. Check complete description HERE.
For getting the details of “Advance settings” option in Application pool please check out another article "IIS App pool Settings". You can also check our below video for detailed explanation.
Why do we need app pool in IIS?
OR
What does an application pool in IIS do?
Application pools increases the reliability and manageability of our web infrastructure. We can also choose/used default application pool, but it is best practice to create separate application pool for each application. Every application pool serves as a container for selected applications and other applications has no impact on our application if we'll use separate application pool.
What is max pool size in IIS?
Its value can vary between 64 and 256. You cannot set more than 256 IIS threads under this setting.
Application Pool stopped but cannot start again.
If your 'Application Pool' is not starting again then to solve this problem, you can open Services window and confirm whether "Windows Process Activation Service" (WAS) is running or not. It should be in running state.
Application pool troubleshooting (Important points)
If you are facing issue with "Application Pool" then you can try the following points, hopefully these will help you solving the issue.
- Check and change the "Application Pool" recycle settings.
- Recycle your "Application Pool".
- Restart "Application Pool" or your website.
- Increase "Application Pool" queue-length limit.
- Configure "rapid fail" protection.
- Check IIS logs for getting details of error.
- Disable IIS redirection rules for trouble shooting purpose only. (If present in Web.config )
- Disable "Custom Error" configuration in web.config to get more detailed error.
Check Out Complete Video on 'Application Pool'.
I hope with the end of this article you got the understanding about the role of IIS and how to control the CPU & Memory usages. You can also check Application Pool Identities.
IIS App Pool Settings
In this article we’ll explain you about IIS app pool settings. If you have not checked our previous articles, then please check out those before proceeding with current one. Our Previous articles can be found above.
What is IIS?
Application pool in IIS
After reading this article you will know the followings:
Key Points of Application Pool
- It creates isolation between different web applications.
- It can enhance the performance of website.
- It Improve manageability of website.
- Each new application will have its separate App pool, one application will not impact other application.
- You can limit CPU & memory usages by the given App pool.
Below is the Application pool "Advanced Settings" window where you can do multiple settings as per website need, below we'll discuss all of these options one by one. Please check out below
IIS “application pool” advanced settings options:
All settings appearing in above image are explained in below section. I hope with the below given explanation you will get deep understanding about application pool's various configurations.
CLR Version:
Here under these options, we can set the CLR versions of application you can choose correct CLR against your .NET version.
Enable 32-bit application:
Change the “Enable 32-bit Applications” to true (if you want the application pool to start and work in a 32-bit mode). If you have legacy application which runs on 32-bit, then you select it to true. In case of 64-bit supporting application, you can make it false so that 64-bit worker process can be user instead of 32-bit.
Managed Pipeline mode:
There are of two types “Integrated mode” and “Classic mode”. You can find the details of these in below section.
- Integrated Mode: As the name indicate Integrated mode makes ASP.NET an integral part of IIS. It has many advanced features as compared to Classic Mode. In previous versions Forms Authentication, Session, were the part of ASP.NET only but now it is in IIS and can also be managed from IIS too.
- Classic Mode: UP to IIS 6.0 there was only classic mode and Integrated mode was introduced after this version. Classic mode uses ISAPI add-on to IIS, and it is used to support backward compatibility but its lacks many of the features in it which are present in integrated mode.
Name:
This section contains the name of “application pool “which you have given at the time of creating this App pool.
Queue Length:
Under this section we can define the Queue limit which means what is maximum number of requests app pool and queue, default is 1000. You can increase this number if your application is having high traffic, if number of requests go beyond 1000 (as per set limit) then server starts throwing internal server error to the users which are accessing website or web API.
Start Mode:
Under this option you have two options using which you can configure App pool to run “On Demand” and or “Always Running”. By default, option is “On Demand”.
CPU: Limit(percent):
Under this option we can restrict the CPU usage that App pool can use. Zero means 100% CPU can be used but we can give percentage here like 50. Using this CPU usage will not go above the defined limits.
Limit Action & Limit Interval (minutes):
Under this option we can set the action which you want to take when CPU threshold is reached (as defined in the above option). As an action you can either opt to kill the worker process exe or “No Action”. In case of "No Action” nothing will be done but event log is written in the window to know when there were maximum CPU usages.
App Pool Identity:
In Application pool identity we have four Built-in user account: These are the four types of built-in user accounts.
- Local System: In this local AD user is used on the Web server. It is more trusted and can also access network resources.
- Network Service: It is a limited access service account and best for security reasons.
- Local Services: It is same as above network services, but it cannot access network resources.
- ApplicationPoolidentity: App pool run under the significance of user who has logged in that operating system where application is hosted.
Custom user account:
Under this option you can pass the credential of another user or service/admin account, and it can provide the required access to the app pool. Click on set button in below image, it will ask for the username and password.
A custom account is useful in the following situations:
- When you want to increase or decrease the security.
- In case of multiple customers on server, we can create the users with different set of permission to meet the need of applications. We cannot create on suite fill all type user.
Maximum worker process:
Under this option we can set the number of worker process to the app pool. Worker process exe w3wp.exe is mainly responsible for all activities of app pool. Increasing the worker process may also increase your application performance but at least it also depends upon your hardware configuration too. Please note you can get issue with multiple worker process if you are using sessions.
Let’s understand this with the help of example, suppose you have set 2 worker processes, as we know session is stored on server in worker process. So, session will get stored in, say first worker process and every time request is not server by First worker process which is having session in it. When request will go to worker process number two, it will not have session and your request will break. Only request which will be served by second worker process will break whereas others will work.
How to Control CPU and Memory usages
Under CPU you can see "Limit (Percent)" – Under this option we can restrict the CPU usage that specific Application pool can use. 0 or 100 means 100% CPU can be used but we can give percentage here like 50. Using this option CPU usage will not go above the defined limits. You can check more of CPU and Memory usages in our separate article HERE.
How to handle large number of requests and avoid 503 "Server Unavailable" error.
Under application pool advanced settings, you can see one option "Queue length" with value 1000 which means system can queue up to 1000 requests in its queue, next coming request will start receiving 503 "Server Unavailable" error.
To fix this issue, you can increase its value to 2000 or more as per the need of your application traffic. 1000 is the default value and you need to change this only when your application is having large traffic.
I hope with above explanation you will get understand about the IIS, application pool and also about its various configurations. For more information you can refer Microsoft Docs.
How to enable Application Pool recycle logging
In this article we’ll discuss How to enable Application Pool recycle logging in IIS and where to find the resulting logs history. By default, IIS do not log all the events so we need to instruct it so that all the recycling event information can be logged and traced if required while doing troubleshooting.
App Pool recycles will only trigger for active Worker process. If no one is using the application, then due to inactivity no worker process will be active, and App Pool recycles will not trigger and no logs can be seen in event viewer.
What you'll learn below:
Steps to Enable Application Pool recycle logging
- Open IIS Manager and expand the server's name then Application Pools. List of application pool will be visible to you.
- Right Click the application pool for which you want to enable the recycle logging, now click the "Advanced Settings".
- Next, expand "Generate Recycle Event Log Entry" then set the desired child nodes to True, then click OK.
How to check app pool recycle history:
Now to check Application Pool recycle events logs in event viewer, simply open the Event Viewer and click on the standard System event log.
In my case I just cleared the event logs manually and then recycle the desired application pool. After this I was able to see the event entry shown below:
A lot more event entries will be there in event logs. To view only Application Pool "recycle events" you can add a filter to see required event only. Hence using the above steps, you can enable Application Pool recycle logging and can view app pool recycle history logs.
I hope with the end of this article you got the understanding on "How to enable Application Pool recycle logging" and "How to check app pool recycle history".
Manage IIS Server Memory Usage
In this article we’ll discuss how to Manage IIS Server Memory Usage. IIS issue a worker process for every Application Pool configured in it. From the screenshot of Task Manager, it’s really hard to find which worker process belongs to which IIS Application Pool and which web application is consuming more memory and need attention. You can Identify worker process using its PID and can do the needful.
If any worked process or PID is consuming more memory, then we need to manage its use else other application hosted on same server will be killed or become down.
Manage IIS Server Memory Usage
There are multiple ways to handle the memory usages in IIS, let’s discuss those possible ways.
- Open IIS.
- Under sever name select ‘Application Pool’ option. You’ll see the list of available app pools.
- Select the required app pool and select ‘Recycling’ option as shown in above image.
- On click of ‘Recycling’ Following screen will appear.
Here we have multiple way to do ‘Recycling’ and Manage IIS Server Memory Usage.
Let’s discuss:
- Fixed Intervals: We can define number of requests after which recycle will take place and new worker process will be assigned. You can see new PID which indicate new worker process assigned after recycling.
- Fixed Number of Requests: Recycle can also be done after FIXED number of requests. You can set the limit and after that app pool recycle will take place.
- Specific Time: Recycle can be done at specific time.
- Memory based Maximums: It can also be done by defining the maximum limit of memory, when worker process will use more memory then defined at that time recycle will take place.
You can use any of the above defined settings. You can apply above settings on required worker processes and once it will hit this limit, a new worker process for the same pool will be created that it will take care of processing all incoming requests. You can observe new PID in task manager which indicate that new worker process has been initialized after recycle. Once this initiation is finished, previous worker process will stop and new will come in action.
For trouble shooting if you want to know when specifically recycle has done, you can check our article How to enable Application Pool recycle logging. After enabling logging, you can view all recycling events in Event Viewer.
I hope with the end of this article you got the understanding on how to Manage IIS Server Memory Usage and where we can see recycling logs.
How to find Worker Process and PID in App Pool
In this article we’ll learn “How to find Worker Process and PID in App Pool”. When we have to analyze resource utilization at that moment PID helps us.
Using Task manager, we can see the PID which is using more resources and we can ‘split up’ that App Pool for better performance. i.e. if given application pool is allocated to multiple applications it may take more resources and by splitting it further, we can get good performance from these applications.
Let's find Worker Process and PID in Task Manager:
In below screen 2 worker processes are getting executed at this moment and their PID are 19712 and 19196.
Let's find Worker Process and PID in IIS:
Next open IIS and select server name and double click on ‘Worker process’ ICON as shown below
On double click of Worker Process icon following screen will open where you can see active Worker processes and can identity it by using its PID and can take the necessary action of splitting up for performance enhancement.
Note - if the application pool is not active or sleeping, it will NOT be listed in above screen. App pool become inactive/sleeping when no one accessing that application.
Additionally, app pool displays also depend upon its setting (refer below screen shot). "Always running" will keep it running all the time where as "On Demand" will launch worker process exe on demand else it will remain inactive or in sleep mode.
In this article you have learned “How to find Worker Process and PID in App Pool”. All this is used in analyzing resource utilization.
How to check App pool is 32 bit or 64 bit
In this article we’ll discuss about how to check App pool is 32 bit or 64 bit using command. 32-bit app pool is used to run 32-bit only application whereas 64 bit is used for 64-bit application.
You need to run the following command using administrative privileges. Open the command prompt using “run as administrator” and type the following command, you’ll get the required list of app pool.
Note: If you will run cmd without ‘Run as administrator’ you may get the permission issue.
To list all AppPools:
c:\Windows\System32\inetsrv\appcmd list apppool
Output of above command:
To list only 32-bit App Pools:
c:\Windows\System32\inetsrv\appcmd list apppool /enable32BitAppOnWin64:true
Output of above command:
Manual way to check app pool either 32 bit or 64 bit
Apart from the above command you can manually check the required App pool whether it is 32 bit or 64 bit. Follow the below steps to check it:
- Open IIS
- Under sever name select 'Application Pool' option. You’ll see the list of available app pools.
- Select the required app pool and right click and go to advance setting option.
- Following screen will appear
- If "Enable 32 Bit Applications" = True (it is 32 bit enable application)
- If "Enable 32 Bit Applications" = False (it is 64 bit enable application)
In this article we discuss 2 ways by which we can check whether application pool is 32 bit or 64 bit enabled.
How to enable 32-bit applications on IIS
In this article we’ll explain you 'How to enable 32-bit applications on IIS' with an example. Let's check how to enable 32-bit applications in 'Application Pool' of IIS Server.
What you'll learn below:
Basically in 64 Bit windows operating systems, by default 64 Bit .NET Framework is installed, and 64 bit worked process is used and when you try to deploy a 32-Bit only application on this IIS Server it results in an error. Error will appear like shown below:
How can we solve this error?
We can solve this error by explicitly telling the IIS server that which worked process is to be used. If your window operating systems is 32 bit and application is only 32 bits supportive then it will work without any settings. If operating systems is 64 bit and we are trying to run 32-bit only application, then “Enable 32-bit application” setting is required to run the application correctly.
Steps explains how to enable 32-bit applications on IIS
We have following ways to enable this setting on App pool.
- Open IIS by typing inetmgr command in the window’s run.
- After opening IIS, select ‘Application Pools’ option under the server's name. You will get the list of available application pools as shown below.
- Now right click on the Application Pool (Test app pool in my case) for which you want to enable 32 Bit applications and click on Advanced Settings option from the context menu.
- In the Advanced Settings window, find out “Enable 32-Bit Applications” property, set it to True and click the OK button.
That’s all you have to do for this setting. I believe after reading this article you have gained understating of how to run 32 Bit only application on 64 Bit windows operating system.
No comments:
Post a Comment