ASP.NET Request Processing Internals

8,458 views

Published on

ASP.NET Request Processing Overview. Presented at Microsoft User Group Hyderabad Community Meet !

Published in: Technology
  • Be the first to comment

ASP.NET Request Processing Internals

  1. 1. ASP.NET Request Processing Internals<br />Abhijit Jana<br />Consultant | Microsoft<br />http://abhijitjana.net<br />
  2. 2. Agenda<br />Role of Web Server<br />ASP.NET Request Processing Internals<br />Internal of Web Server<br />Request Processing<br />Request Pipeline<br />Page Life Cycle<br />
  3. 3. Getting Started<br /><ul><li>Visual Studio IDE has it own Integrated ASP.NET Runtime
  4. 4. ASP.NET Development Server
  5. 5. WebDev.WebServer20.exe ( CLR 2.0 )
  6. 6. WebDev.WebServer40.exe (CLR 4.0 )
  7. 7. ASP.NET Development Server Runs on Specific Port</li></li></ul><li>Demo<br />
  8. 8. Moving to IIS<br />Process Request<br />(w3wp.exe)<br />Request<br />Response<br />
  9. 9. Key Concept<br />Application Pool<br />Worker Process<br />Web Farm<br />Web Garden<br />IIS<br />Application Pool<br />Application Pool<br />Application Pool<br />Worker Process<br />Worker Process<br />Worker Process<br />w3wp<br />Web Application 1<br />Web Application 2<br />Web Application 3<br />Web Application 4<br />
  10. 10. Application Pool and HTTP.SYS<br />IIS<br />Application Pool<br />Application Pool<br />Application Pool<br />W3wp.exe<br />W3wp.exe<br />W3wp.exe<br />HTTP.SYS<br />ApplicationHost.Config<br />
  11. 11. Demo<br />
  12. 12. Protocol Listener [ HTTP.SYS ]<br />Protocol Listener is the part of Kernel Level of IIS<br />Protocol listeners receive protocol-specific requests<br />send them to IIS for processing<br />return responses to requestors<br />It the Kernel mode Protocol stack which listens to the HTTP and HTTPSRequest<br />Kernel-mode caching<br />Kernel Mode Queuing<br />
  13. 13. WWW service and WAS<br />Part of User Level of IIS<br />World Wide Web Publishing Service (WWW service) and Windows Process Activation Service (WAS) run as Local System in the same Svchost.exe process<br />Performance Monitoring<br />Processing Monitoring<br />Configuration Management<br />Svchost.exe<br />Windows Process Activation Service (WAS)<br />World Wide Web Publishing Service (WWW service)<br />HTTP.SYS<br />
  14. 14. Overall View Of IIS<br />Application Pool<br />ApplicationHost.Config<br />Svchost.exe<br />World Wide Web Publishing Service (WWW service)<br />Windows Process Activation Service (WAS)<br />HTTP.SYS<br />
  15. 15. Looking bit Inside of Request Processing<br />HTTP Module<br />HTTP Module<br />IIS<br />HTTP Module<br />Application Pool<br />Application Pool<br />Svchost.exe<br />Application Pool<br />W3wp.exe<br />W3wp.exe<br />W3wp.exe<br />WWW service<br />WAS<br />HTTP Module<br />HTTP Module<br />HTTP.SYS<br />HTTP Handler<br />HTTP Handler<br />
  16. 16. Request Processing Continue..<br /><ul><li>Client Send a Request, HTTP.sys intercepts the request.
  17. 17. HTTP.sys Interacts with WWW Publishing Services and sync with the related configuration stored in applicationHost.config.
  18. 18. The WWW Service receives configuration like application pool, virtual directory, site details from applcationHost.config
  19. 19. WWW Publishing Services gets the request from Http.Sys and passed to WAS
  20. 20. WAS starts a worker process for the application pool associated with the request was made.
  21. 21. Workerprocess execute ASP.NET Internals operations
  22. 22. The worker process processes returns a response to HTTP.sys.
  23. 23. The client receives a response from Server.</li></li></ul><li>Inside Worker Process (w3wp.exe) <br />HTTP Module<br />W3wp.exe<br />HTTP Module<br />aspnet_isapi.dll<br />HTTP Module<br />.NET Runtime<br />Http Application<br />HTTP Module<br />HTTPRuntime<br />HTTP Module<br />HTTPProcessRequest<br />HTTP Handler<br />HTTP Handler<br />HTTPContext<br />HTTP Application<br />HTTP ApplicationFactory<br />
  24. 24. Demo<br />
  25. 25. Inside Worker Process (w3wp.exe) cond..<br />W3wp.exe<br />Web Server Core<br />Modules<br />BeginRequest<br />BasicAuthenticationModule<br />Authentication<br />HttpCacheModule<br />Authorization<br />StaticCompressionModule<br />Cache Resolution<br />DynamicStaticCompressionModule <br />Handler<br />URL Authorization<br />Release State<br />Tracing<br />Update Log<br />HTTP Error<br />End Request Processing<br />HTTP Logging<br />
  26. 26. HTTP Pipeline<br /><ul><li>Modules are individual features that the server uses to process requests
  27. 27. Plug-in / out modules you want on the server or Application Specific.
  28. 28. customize a server to a specific role in your environment.
  29. 29. custom modules to replace existing modules or to introduce new features based on application on server specific
  30. 30. Content Module ( IsapiFilter ,IsapiFilterModule )
  31. 31. Security Module (BasicAuthenticationModule )
  32. 32. Caching Module ( HttpCacheModule)
  33. 33. Compression Module ( StaticCompressionModule )</li></ul>HTTP Module<br />HTTP Module<br />HTTP Module<br />HTTP Module<br />HTTP Module<br />HTTP Handler<br />HTTP Handler<br />
  34. 34. ASP.NET Routing<br />W3wp.exe<br />Web Server Core<br />BeginRequest<br />Authentication<br />Routing Module<br />Authorization<br />Cache Resolution<br />Handler<br />IHandler<br />Release State<br />Update Log<br />End Request Processing<br />
  35. 35. Once done with HTTP Pipeline<br />Page_PreInit<br />Page_Init<br />ASP.NET Page Life Cycle<br />Load View State<br />Load Post Back Data<br />Page_Load<br />Page Post back event<br />Pre Render<br />Save View State<br />Render<br />Unload<br />
  36. 36. Summary<br />
  37. 37. Resource for further Study<br /><ul><li>A low-level Look at the ASP.NET Architecture
  38. 38. IIS URL Rewriting and ASP.NET Routing
  39. 39. IIS 7.0 Request Filtering and URL Rewriting
  40. 40. Securely Implement Request Processing, Filtering, and Content Redirection with HTTP Pipelines in ASP.NET</li></li></ul><li>Q/A<br />
  41. 41. Thank You !<br />Abhijit Jana<br />Blog : http://abhijitjana.net<br /> http://dailydotnettips.com<br />Twitter : @AbhijitJana<br />

×