IIS basics

Share it:


        Role of IIS

Visual studio having It own ASP.NET Engine which is capable enough to run Asp.net web application from visual studio. So we just click on Run button to start the application.Now this is the scenarios of local environment.
     
      But If we want to host it on server from where all user can access the sites then IIS comes into the picture.

IIS provides a redesigned WWW architecture that can help you achieve better performance, reliability, scalability, and security for our Web sites.

IIS can support following Protocol HTTP/HTTPS, FTP, FTPS, SMTP Etc.

We need to host the site on IIS, when request comes from client it first hits the IIS Server, then the server passed it to ASP.NET worker process to execute. Then the response also passes to client via IIS itself.

Note only Hosting of Site we can create our FTP Server, SMTP Server using IIS itself.There are different version of IIS available like 5.1, 6.0, 7.0 etc.

     IIS service names

  • WWW Services
  • FTP Services
  • SMTP Services
  • NNTP Services

     IIS port numbers

  • HTTP (Default port of IIS) : 80
  • SSL  : 443
  • FTP  : 21
  • SMTP  : 25
  • POP2  : 109
  • POP3  : 110
  • IMAP  : 143
  • NNTP  : 119
  • LDAP  : 89
  • DNS  : 53
  • DHCP : 67

There are two ways to open IIS manger,

1) Run (Press Windows Key + R) -> Type, INETMGR

2) open IIS Manager from control panel > Administrative tools

  Main layers of IIS Architecture

IIS having mainly two layer Kernel Mode and User Mode
  • Kernal Mode : HTTP.SYS
  • User Mode : Web Admin Services, Virtual Directory, Application Pool

  Role of HTTP.SYS in IIS

HTTP.SYS is the kernel level components of IIS. All client request comes from client hit the HTTP.Sys of Kernel level. HTTP.SYS then makes a queue for each and every request for each and individual application pool based on the request.Whenever we create any application pool IIS automatically registers the pool with HTTP.SYS to identify the particular during request processing.

>> How does IIS Process ASP.NET Requests ?

When client request for an aspx pages, request comes to kernel level off IIS means to HTTP.SYS. HTTP.SYS receives the request and based on the application pool name (Which is already registered with the HTTP.SYS ) it send the request to worker process. Windows Activation process works as mediator of them. w3wp.exe loads aspnet_isapi.dll files to start the HTTPRuntime. HTTPRuntime creates HTTPApplication objects and all request are passed through HTTP Module and finally reached to HttpHandler. This is the request pipeline. After end of Request pipeline ASP.NET Page lifecycle starts.

  Application Pool in IIS Server

Application pools are used to separate sets of IIS worker processes that share the same configuration and application boundaries. Application pools used to isolate our web application for better security, reliability, and availability and performance and keep running without impacting each other .

The worker process serves as the process boundary that separates each application pool so that when one worker process or application is having an issue or recycles, other applications or worker processes are not affected. One Application Pool can have multiple worker process Also.

Default application pool named : DefaultAppPool

  properties of App Pool

  • Recycling
  • Perfomance
  • Health
  • Identity

  Recycling of Application Pool

Recycling Application pool means recycle the Worker process (w3wp.exe) and the memory used for the web application.
There are two types of recycling related with Application pool.
  • Recycling Worker Process – Predefined Settings
  • Recycling Worker Process – Based on Memory

 worker process for IIS 5.1 and IIS 6.0 and IIS 7.0

  • IIS 5.1 : aspnet_wp.exe
  • IIS 6.0 > w3wp.exe
  • IIS 7.0 (and beyond) : w3wp.exe

   Main components of SVCHost.exe

Main components for SVCHost.exe are WWW Publishing Service (W3SVC) and Windows Activation Porcess (WAP) .
W3SVC is the mediator of HTTP.SYS and Windows Activation Process. Windows Activation Process maintain the worker processes.

  Role of Windows Activation Process in IIS

WAP is the Controller of Worker process under a Application Pool. Windows Activation Process which is managed by the worker process by starting, stopping and recycling the application pool. When to start, stop and Recycle should be defined on Application Pool Settings. Activation Process is also responsible for Health Monitor of Application Pool during runtime.

  Default Identity of an Application Pool >> Network Services.

  Different type of application pool available in IIS 7.0

  • DefaultAppPool (Integrated)
  • ClassicAppPool

  App Pool and App Domain. (the difference)

Application pool and AppDomain , both of them can provide isolations, but use different approches.

Application pool use the process to isolate the applications which works without .NET. But AppDomain is another isolation methods provided by .NET.

If your server host thousands of web sites, you wont use thousands of the application pool to isolate the web sites, just because, too many processes running will kill the OS. However, sometime you need application pool. One of the advantages for application pool is that you can config the identity for application pool. Also you have more flexible options to recycle the application pool. At least right now, IIS didn’t provide explicit options to recycle the app domain.

 In case of “In-Proc” Session mode, Session data store inside process memory of worker process [w3wp.exe].

   Web Farm

When we hosted our web Application on multiple web server under a load balancer call the Web Farm. This is generally used for heavy load web application where there are many user requests at a time. So When Web Application is hosted on Different IIS Server over a load balancer, Load balancer is responsible for distribute the load on different server.

 Web Garden

A Web garden is configured on a single server by specifying multiple worker processes for an application pool. Web farms use multiple physical servers for supporting a single Web site.

 Default location for IIS Log files 

C:\WINDOWS\system32\LogFiles\W3SVC1

IMP : We can also change default IIS log location.

   Ue of aspnet_regiis -i command

This is used automatically register the .NET Framework with your IIS.

  How to check Installed .Net Version on IIS

Press Windows Key + R, Type RUN and provide following command to know installed Dot Net version,

C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322>aspnet_regiis.exe –lv

   Stop and restart Internet services

Press Windows Key + R, Type RUN and provide following command to restart IIS Server,

iisreset

  Virtual Directory in IIS ?

A Virtual Folder or Virtual Directory is just a link to a physical folder somewhere on the server. This folder becomes part of the website structure and you can use the virtual directory in the path part of URLs. Code that executes in Virtual Directories will execute in the same “Application” as it’s parent.

  Difference between Virtual Directory and Web App in IIS

A Virtual Folder or Virtual Directory is just a link to a physical folder somewhere on the server. This folder becomes part of the website structure and you can use the virtual directory in the path part of URLs. Code that executes in Virtual Directories will execute in the same “Application” as it’s parent.
An Application is where the code that runs inside that “folder” has it’s own Session state and Application state. It is in effect a new standalone application living underneath the root application. For example, if you were to deploy an ASP.NET application into a site that had an Application folder called /myapp then that application would have it’s own application domain, session state, application state completely separate from another ASP.NET application running in /.

  Create a Virtual Directory on IIS

  • Open IIS Configuration Manager
  • First of all Right Click on Default web sites > New > Virtual Directory.
  • Browse the Physical Path.
  • Set the properties.
  • Click on OK

  Permission settings are available for Virtual Directory

  • Read
  • Run Scripts
  • Execute
  • Write
  • Browse

  Different “Execution Permission” available for IIS for an virtual directory ?

There are three Execution Permission available.
  • None
  • Scripts Only
  • Scripts and Executable
Share it:

Post A Comment:

0 comments: