ASP.NET Request Processing InternalsAbhijit JanaConsultant | Microsofthttp://abhijitjana.net
AgendaRole of Web ServerASP.NET Request Processing InternalsInternal of Web ServerRequest ProcessingRequest PipelinePage Life Cycle
Getting StartedVisual 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 PortDemo
Moving to IISProcess Request(w3wp.exe)RequestResponse
Key ConceptApplication PoolWorker ProcessWeb FarmWeb GardenIISApplication PoolApplication PoolApplication PoolWorker ProcessWorker ProcessWorker Processw3wpWeb Application 1Web Application 2Web Application 3Web Application 4
Application Pool and HTTP.SYSIISApplication PoolApplication PoolApplication PoolW3wp.exeW3wp.exeW3wp.exeHTTP.SYSApplicationHost.Config
Demo
Protocol Listener [ HTTP.SYS ]Protocol Listener is the part of Kernel Level of IISProtocol listeners receive protocol-specific requestssend them to IIS for processingreturn responses to requestorsIt the Kernel mode Protocol stack which listens to the HTTP and HTTPSRequestKernel-mode cachingKernel Mode Queuing
WWW service and WASPart of User Level of IISWorld Wide Web Publishing Service (WWW service) and Windows Process Activation Service (WAS) run as Local System in the same Svchost.exe processPerformance MonitoringProcessing MonitoringConfiguration ManagementSvchost.exeWindows Process Activation Service (WAS)World Wide Web Publishing Service (WWW service)HTTP.SYS
Overall View Of IISApplication PoolApplicationHost.ConfigSvchost.exeWorld Wide Web Publishing Service (WWW service)Windows Process Activation Service (WAS)HTTP.SYS
Looking bit Inside of Request ProcessingHTTP ModuleHTTP ModuleIISHTTP ModuleApplication PoolApplication PoolSvchost.exeApplication PoolW3wp.exeW3wp.exeW3wp.exeWWW serviceWASHTTP ModuleHTTP ModuleHTTP.SYSHTTP HandlerHTTP Handler
Request Processing Continue..Client Send a Request, HTTP.sys intercepts the request.
HTTP.sys Interacts with WWW Publishing Services and sync with the related configuration stored in applicationHost.config.
The WWW Service receives configuration like application pool, virtual directory, site details from applcationHost.config
WWW Publishing Services gets the request from Http.Sys and passed to WAS
WAS starts a worker process for the application pool associated with the request was made.
Workerprocess execute ASP.NET Internals operations
The worker process processes returns a response to HTTP.sys.
The client receives a response from Server.Inside Worker Process (w3wp.exe) HTTP ModuleW3wp.exeHTTP Moduleaspnet_isapi.dllHTTP Module.NET RuntimeHttp ApplicationHTTP ModuleHTTPRuntimeHTTP ModuleHTTPProcessRequestHTTP HandlerHTTP HandlerHTTPContextHTTP ApplicationHTTP ApplicationFactory

ASP.NET Request Processing Internals

  • 1.
    ASP.NET Request ProcessingInternalsAbhijit JanaConsultant | Microsofthttp://abhijitjana.net
  • 2.
    AgendaRole of WebServerASP.NET Request Processing InternalsInternal of Web ServerRequest ProcessingRequest PipelinePage Life Cycle
  • 3.
    Getting StartedVisual StudioIDE has it own Integrated ASP.NET Runtime
  • 4.
  • 5.
  • 6.
  • 7.
    ASP.NET Development ServerRuns on Specific PortDemo
  • 8.
    Moving to IISProcessRequest(w3wp.exe)RequestResponse
  • 9.
    Key ConceptApplication PoolWorkerProcessWeb FarmWeb GardenIISApplication PoolApplication PoolApplication PoolWorker ProcessWorker ProcessWorker Processw3wpWeb Application 1Web Application 2Web Application 3Web Application 4
  • 10.
    Application Pool andHTTP.SYSIISApplication PoolApplication PoolApplication PoolW3wp.exeW3wp.exeW3wp.exeHTTP.SYSApplicationHost.Config
  • 11.
  • 12.
    Protocol Listener [HTTP.SYS ]Protocol Listener is the part of Kernel Level of IISProtocol listeners receive protocol-specific requestssend them to IIS for processingreturn responses to requestorsIt the Kernel mode Protocol stack which listens to the HTTP and HTTPSRequestKernel-mode cachingKernel Mode Queuing
  • 13.
    WWW service andWASPart of User Level of IISWorld Wide Web Publishing Service (WWW service) and Windows Process Activation Service (WAS) run as Local System in the same Svchost.exe processPerformance MonitoringProcessing MonitoringConfiguration ManagementSvchost.exeWindows Process Activation Service (WAS)World Wide Web Publishing Service (WWW service)HTTP.SYS
  • 14.
    Overall View OfIISApplication PoolApplicationHost.ConfigSvchost.exeWorld Wide Web Publishing Service (WWW service)Windows Process Activation Service (WAS)HTTP.SYS
  • 15.
    Looking bit Insideof Request ProcessingHTTP ModuleHTTP ModuleIISHTTP ModuleApplication PoolApplication PoolSvchost.exeApplication PoolW3wp.exeW3wp.exeW3wp.exeWWW serviceWASHTTP ModuleHTTP ModuleHTTP.SYSHTTP HandlerHTTP Handler
  • 16.
    Request Processing Continue..ClientSend a Request, HTTP.sys intercepts the request.
  • 17.
    HTTP.sys Interacts withWWW Publishing Services and sync with the related configuration stored in applicationHost.config.
  • 18.
    The WWW Servicereceives configuration like application pool, virtual directory, site details from applcationHost.config
  • 19.
    WWW Publishing Servicesgets the request from Http.Sys and passed to WAS
  • 20.
    WAS starts aworker process for the application pool associated with the request was made.
  • 21.
    Workerprocess execute ASP.NETInternals operations
  • 22.
    The worker processprocesses returns a response to HTTP.sys.
  • 23.
    The client receivesa response from Server.Inside Worker Process (w3wp.exe) HTTP ModuleW3wp.exeHTTP Moduleaspnet_isapi.dllHTTP Module.NET RuntimeHttp ApplicationHTTP ModuleHTTPRuntimeHTTP ModuleHTTPProcessRequestHTTP HandlerHTTP HandlerHTTPContextHTTP ApplicationHTTP ApplicationFactory
  • 24.
  • 25.
    Inside Worker Process(w3wp.exe) cond..W3wp.exeWeb Server CoreModulesBeginRequestBasicAuthenticationModuleAuthenticationHttpCacheModuleAuthorizationStaticCompressionModuleCache ResolutionDynamicStaticCompressionModule HandlerURL AuthorizationRelease StateTracingUpdate LogHTTP ErrorEnd Request ProcessingHTTP Logging
  • 26.
    HTTP PipelineModules areindividual features that the server uses to process requests
  • 27.
    Plug-in / outmodules you want on the server or Application Specific.
  • 28.
    customize a serverto a specific role in your environment.
  • 29.
    custom modules toreplace existing modules or to introduce new features based on application on server specific
  • 30.
    Content Module (IsapiFilter ,IsapiFilterModule )
  • 31.
    Security Module (BasicAuthenticationModule )
  • 32.
    Caching Module ( HttpCacheModule)
  • 33.
    Compression Module (StaticCompressionModule )HTTP ModuleHTTP ModuleHTTP ModuleHTTP ModuleHTTP ModuleHTTP HandlerHTTP Handler
  • 34.
    ASP.NET RoutingW3wp.exeWeb ServerCoreBeginRequestAuthenticationRouting ModuleAuthorizationCache ResolutionHandlerIHandlerRelease StateUpdate LogEnd Request Processing
  • 35.
    Once done withHTTP PipelinePage_PreInitPage_InitASP.NET Page Life CycleLoad View StateLoad Post Back DataPage_LoadPage Post back eventPre RenderSave View StateRenderUnload
  • 36.
  • 37.
    Resource for furtherStudyA low-level Look at the ASP.NET Architecture
  • 38.
    IIS URL Rewritingand ASP.NET Routing
  • 39.
    IIS 7.0 RequestFiltering and URL Rewriting
  • 40.
    Securely Implement RequestProcessing, Filtering, and Content Redirection with HTTP Pipelines in ASP.NETQ/A
  • 41.
    Thank You !AbhijitJanaBlog : http://abhijitjana.net http://dailydotnettips.comTwitter : @AbhijitJana