1 / 29

Getting the Most Out of IIS

Getting the Most Out of IIS. Ido Flatow Senior Architect Microsoft ASP.NET/IIS MVP SELA Group @ idoflatow. About Me. Senior Architect, Sela Group Co-author of courses and books Microsoft ASP.NET/IIS MVP Focus on server, web, cloud, and DevOps Manager of the Israeli WebDev User Group.

Télécharger la présentation

Getting the Most Out of IIS

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Getting the Most Out of IIS Ido Flatow Senior Architect Microsoft ASP.NET/IIS MVP SELA Group @idoflatow #devconnections

  2. About Me • Senior Architect, Sela Group • Co-author of courses and books • Microsoft ASP.NET/IIS MVP • Focus on server, web, cloud, and DevOps • Manager of the Israeli WebDev User Group

  3. It’s pronounced Ay AyEs • Web application hosting • Comes in two flavors • Full IIS (or simply IIS) • IIS Express • Provides • Reliability • Manageability • Security • Performance • Scalability

  4. History in Screenshots IIS 5.1 IIS 7.5 IIS 8 IIS 8.5 IIS 5 IIS 6 IIS 7 Win 8 WS2012 Win 8.1 WS2012 R2 Vista WS2K8 Win 7 WS2K8 R2 W2K Win XP WS2K3

  5. IIS vs. IIS Express

  6. IIS, the Pipeline, and ASP.NET

  7. IIS Management Your Computer Application Pool Web Site Web Applications Physical Directory Virtual Directory Remote Computers

  8. IIS Configuration ASP.NET Settings Configuration Hierarchy Site machine.config Web.config root Web.config Application Web.config VirtualDirectory Web.config applicationHost.config

  9. The Integrated pipeline Basic Anon Authentication Forms Authorization Windows ResolveCache ASPX / MVC … Static File ExecuteHandler Trace … Native … UpdateCache Managed SendResponse Compress Log

  10. HTTP Request Processing in IIS Widows Process Activation Service (WAS) ApplicationHost.config HTTP protocol stack W3WP.exe Client WWW Service .NET CLR AppDomain … AppDomain

  11. HTTP.SYS, What’s That? • It’s the thing that listens to HTTP on your computer • It’s a kernel-mode device driver • Ever since Windows Server 2003 (IIS 6) • Responsible for: • Routing requests to registered applications • Managing request queues • Kernel-mode SSL (as of Windows Server 2008) • Response caching in kernel mode • QoS, such as connection limits and timeouts • Want to know more? netsh http show

  12. The IIS Application Pool • Groups applications to worker processes • Each app is hosted in a .NET AppDomain • App pool defines: • .NET version • Bitness (32/64) • Security identity • And a lot more

  13. App Pool Configuration • Startup mode • CPU usage limits • Process timeouts • Idle • Ping • Shutdown / Startup • Web garden • Rapid-Fail protection • Process orphaning • Auto recycling

  14. App pool configuration Demo

  15. IIS Features

  16. Compressing Responses So turn it on, is that it? Almost!

  17. Rewriting URLs • Great tool for manipulating URLs • Can change incoming and outgoing URLs • URL transformation, redirection, or forwarding • RegEx and wildcards for pattern matching • Pre-conditions based on HTTP headers, URL fragments, and server variables • And it has a UI !!!!!

  18. Common Rewriting Scenarios • Enforce lower-cased URLs • Add/remove trailing slash • Canonical hostnames • Prevent hotlinking • Resource versioning • HTTPS redirection • Reverse proxy

  19. Application Initialization • Initial load of an application takes time • Dynamic compilation • Assembly loading • Execute Application_Start event • Application initialization to the rescue • Loads the AppDomain after W3WP loads • Can internally call an initialization URL

  20. Configure Initialization Application Pool Web Application Web.config <system.webServer> <applicationInitializationremapManagedRequestsTo=“Loading.htm" skipManagedModules="true" ><add initializationPage="/init.ashx" /></applicationInitialization> </system.webServer>

  21. Cool Features of Initialization • Remaps requests while initializing • Overlapped recycling completes after initialization is done • Granular control over remaps with URL Rewrite • {APP_WARMING_UP} server variable • Still using IIS 7.5? Get the extension! • http://bit.ly/iis-application-initialization

  22. IIS Features Demo

  23. Logging & troubleshooting

  24. Logging Advanced Logging • IIS logging is not enough! • Use the Advanced Logging module • http://bit.ly/iis-advanced-logging • Create a separate log file per application • Log HTTP headers, performance counters, and server variables • Filter requests you don't want to log • Creates the same IIS Log file structure (almost) • Use your existing analysis tools

  25. Failed Request Tracing • Investigate failed requests • What is a bad request? • Resulted in a 4xx or 5xx response • Took too long to process • Caused a warning or error trace message • You can set different traces for different URLs • Use the System.Web.IisTraceListener trace listener for custom traces • Beware of overuse! • Investigate bad requests

  26. Logging & troubleshooting Demo

  27. IIS 8.5 • Released with Windows Server 2012 R2 • Some new cool features • Logging with ETW • Enhanced logging • Worker process timeout suspension • Dynamic site configuration loading • Auto-binding of renewed certificates

  28. Resources Everything About IIS www.iis.net Extensions and Apps www.iis.net/downloads/microsoft/advanced-logging www.lizard-labs.net/log_parser_lizard.aspx gallery.technet.microsoft.com/office/Log-Parser-Studio-cd458765 www.iis.net/downloads/community/2008/03/iis-70-trace-viewer idof@sela.co.il @idoflatow http://bit.ly/flatow-blog This presentation: http://1drv.ms/1A4VGk9

  29. Rate with Mobile App: Rate This Session Now! Tell Us What You Thought of This Session Select the session from the Agenda or Speakers menus Select the Actions tab Click Rate Session Be Entered to WIN Prizes! Rate Using Our Website: Register at www.devconnections.com/logintoratesession Go to www.devconnections.com/ratesession Select this session from the list and rate it

More Related