Inside IIS Request Processing and ASP.NET Page Lifecycle

Post on 06-May-2015

15.843 views 2 download

description

Topic Covered : ASP.NET Runtime Engine and Visual StudioRole of a Web ServerKey Concepts of IISIIS and ASP.NET Requests ProcessingInside Worker ProcessInternals of Http Pipeline Page Lifecycle Internals

Transcript of Inside IIS Request Processing and ASP.NET Page Lifecycle

IND 14-16 Dec.

Inside IIS Request Processing and ASP.NET Page LifecycleAbhijit Jana | Consultant | Microsofthttp://abhijitjana.net @abhijitjana

IND 14-16 Dec.

ASP.NET Runtime Engine and Visual Studio Role of a Web Server Key Concepts of IIS IIS and ASP.NET Requests Processing Inside Worker Process Internals of Http Pipeline Page Lifecycle Internals

Agenda

IND 14-16 Dec.

ASP.NET Runtime Engine and Visual Studio Visual Studio IDE has it own Integrated ASP.NET

Runtime ASP.NET Development Server

WebDev.WebServer20.exe ( CLR 2.0 ) WebDev.WebServer40.exe (CLR 4.0 )

ASP.NET Development Server Runs on Specific PortLocal Development System

Visual Studio

Web Applicatio

n

ASP.NET Development ServerWebdev.WebServer20.e

xeWebdev.WebServer40.e

xe

IND 14-16 Dec.

DEMOHow Visual Studio Runs ASP.NET Application ?

IND 14-16 Dec.

Moving to IIS

Local Development System

Visual StudioWeb

Application

Local IIS

Worker Process

Process Request

(w3wp.exe)

Request

Response

IND 14-16 Dec.

Key Concepts Application Pool Worker Process Web Farm Web Garden

IISApplication Pool

Worker

Process

Application Pool

Application Pool

Worker

Process

Worker

Process

Web Application 1

Web Application 2

Web Application 3Web Application

4

w3wp

IND 14-16 Dec.

HTTP.SYS

HTTP.SYS

IIS User Level

Application Pool

W3wp.exe

Application Pool

W3wp.exe

Application Pool

W3wp.exe

ApplicationHost.Config

IND 14-16 Dec.

Protocol Listener [ HTTP.SYS ] Protocol Listener is the part of Kernel Level of IIS Protocol listeners receive protocol-specific requests send them to IIS for processing return responses to requestors It the Kernel mode Protocol stack which listens to the

HTTP and HTTPS Request Kernel-mode caching Kernel Mode Queuing

IND 14-16 Dec.

DEMORegistering Application Pool

IND 14-16 Dec.

WWW service and WAS Part of User Level of IIS World Wide Web Publishing Service (WWW service) and

Windows Process Activation Service (WAS) run as Local System in the same Svchost.exe process

Performance Monitoring Processing Monitoring Configuration Management

Svchost.exe

World Wide Web Publishing Service (WWW service)

Windows Process Activation Service (WAS)

HTTP.SYS

IND 14-16 Dec.

Overall View Of IIS in Request Processing

Svchost.exe

World Wide Web Publishing Service

(WWW service)

Windows Process Activation Service

(WAS)

HTTP.SYS

Application Pool

ApplicationHost.Config

IND 14-16 Dec.

Overall View Of IIS in Request Processing

Svchost.exe

World Wide Web Publishing Service

(WWW service)

Windows Process Activation Service

(WAS)

HTTP.SYS

Application Pool

ApplicationHost.Config

Worker Process (w3wp.exe)

HTTP Module

HTTP Module

HTTP Module

HTTP Module

HTTP Module

IND 14-16 Dec.

Application Pool

Inside Worker Process ( w3wp.exe)

W3wp.exe

aspnet_isapi.dll

Http Application

HTTP Module

HTTP Handler HTTP Handler

HTTP Module

HTTP Module

HTTP Module

HTTP Module

HTTPRuntime

HTTPProcessRequest

HTTPContext

HTTP Application

HTTP ApplicationFactory.NET R

unti

me

IND 14-16 Dec.

DEMOIISAPI Process Request and Application Domain Creation

IND 14-16 Dec.

Inside Worker Process ( w3wp.exe)

ISAPIRuntime.ProcessRequest() HttpRuntime.ProcessReq

uest

Create New Instance of HttpContext

Load HttpApplication Calls

HttpApplication.Init()

IND 14-16 Dec.

HTTP Application Created By HTTPApplicationFacotry class It’s create pool of HTTPApplication Object

W3wp.exe

Web Server Core

BeginRequest

Modules

Authentication

Authorization

Cache Resolution

Handler

Release State

Update Log

End Request Processing

BasicAuthenticationModule

HttpCacheModule

StaticCompressionModule

DynamicStaticCompressionModule

URL Authorization

Tracing

HTTP Error

HTTP Logging

IND 14-16 Dec.

HTTPContext.Current.Items

IND 14-16 Dec.

Application

HTTPModule

Handler Factory

HTTPHandler

ASP.NET Page

HTTP Pipeline Request Flow

IND 14-16 Dec.

DEMOHTTP Application and HTTP Module

IND 14-16 Dec.

DEMORetrieve Module Specific Information

IND 14-16 Dec.

IND 14-16 Dec.

Svchost.exe

World Wide Web Publishing Service

(WWW service)

Windows Process Activation Service

(WAS)

HTTP.SYS

Application Pool

ApplicationHost.Config

W3wp.exe

Web Server Core

BeginRequest

Modules

Authentication

Authorization

Cache Resolution

Handler

Release State

Update Log

End Request Processing

BasicAuthenticationModule

HttpCacheModule

StaticCompressionModule

DynamicStaticCompressionMod

ule

URL Authorization

Tracing

HTTP Error

HTTP Logging

1

2

3

4

5

6

7

89

10

11

12

Quick Recall !!!

IND 14-16 Dec.

IND 14-16 Dec.

Request Flow in ASP.NET

IIS

Global.aspx

ASP.NET Runtime

HTTPPipeline

ASP.NET Pages

IND 14-16 Dec.

ASP.NET Page Lifecycle

Page_PreInit

Page_Init

Load View State

Load Post Back Data

Page_Load

Page Post back event

Pre Render

Save View State

Render

Unload

IND 14-16 Dec.

DEMOInternals of ASP.NET Page Life Cycle

IND 14-16 Dec.

Visual Studio Integrated Web Server Execution Process

Application Pool, Worker Process, Web Farm, Web Garden

User Level and Kernel Level of IIS Application Configuration, SVCHOST.EXE, WWW,

WAS IISAPI Filter, HTTP Module and HTTP Handler ,

Handler Factory HTTP Pipeline, ASP.NET Routing Module Page Life Cycle Internal Events

KEY TAKEAWAY

IND 14-16 Dec.

Resources

http://msdn.microsoft.com/ http://technet.microsoft.com/

msdnindia technetindia

@msdnindia

@technetindia

SOFTWARE APPLICATION DEVELOPER

INFRASTRUCTURE PROFESSIONALS

IND 14-16 Dec.

© 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

Abhijit Jana | Consultant | Microsoftabhijan@microsoft.com | abhijit.jana@microsoft.com http://abhijitjana.net @abhijitjana

Thank You !