IIS for Developers

Uploaded on

Introduction to IIS, the integrated pipeline and application pool. Introduction to IIS features, such as compression, caching, URL rewriting, and application initialization. Troubleshooting IIS with …

Introduction to IIS, the integrated pipeline and application pool. Introduction to IIS features, such as compression, caching, URL rewriting, and application initialization. Troubleshooting IIS with logging and failed request tracing.

More in: Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads


Total Views
On Slideshare
From Embeds
Number of Embeds



Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

    No notes for slide
  • Show advanced window of app poolDiscuss the settings on-demand, always-onCPU usage – show throttling demoWeb garden – explain it’s useful either if you are using 32-bit or if you have more than 64 coresOrphaning – show orphaning demoAuto recycle – good if your application consumes too much memory
  • http://blogs.iis.net/ruslany/archive/2009/04/08/10-url-rewriting-tips-and-tricks.aspx
  • Status bar – where the configuration changes are storedConfiguration editorAdd compression for jsonGenerate script (show that you can generate C# and PowerShell code)
  • Advanced loggingFailed request tracingLog parser lizardTrace viewer list


  • 1. Ido Flatow Senior Architect Microsoft ASP.NET/IIS MVP SELA Group IIS For Developers Everything You Wanted to Know about IIS but were Afraid to Ask (IT) @idoFLATOW http://bit.ly/flatow-blog This presentation: http://sdrv.ms/15QPjke
  • 2. www.devconnections.com IIS FOR DEVELOPERS IT’S PRONOUNCED AY AY ES  Web application hosting  Comes in two flavors  Full IIS (or simply IIS)  IIS Express  Provides  Reliability  Manageability  Security  Performance  Scalability 2
  • 3. www.devconnections.com IIS FOR DEVELOPERS HISTORY IN SCREENSHOTS 3 W2K Win XP WS2K3 Vista WS2K8 Win 7 WS2K8 R2 Win 8 WS2012
  • 4. www.devconnections.com IIS FOR DEVELOPERS IIS CONCEPTS 4 Your Computer Remote Computers Web Site Web Applications Virtual Directory Physical Directory Application Pool
  • 6. www.devconnections.com IIS FOR DEVELOPERS 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  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 6
  • 7. www.devconnections.com IIS FOR DEVELOPERS THE INTEGRATED PIPELINE 7 Log Compress Basic Static File Anon SendResponse Authentication Authorization ResolveCache ExecuteHandler UpdateCache … … Forms Windows ASPX Trace …
  • 8. www.devconnections.com IIS FOR DEVELOPERS CONFIGURATION HIERARCHY 8 Site Application Virtual DirectoryIIS Configuration ASP.NET settings machine.config root Web.config applicationHost.config Web.config Web.config Web.config
  • 9. www.devconnections.com IIS FOR DEVELOPERS THE IIS APPLICATION POOL  Groups applications to worker processes  Each application is hosted in a .NET AppDomain  App pool defines:  .NET version  Bitness (32/64)  Security identity  Advanced settings 9
  • 10. www.devconnections.com IIS FOR DEVELOPERS APP POOL CONFIGURATION  Startup mode  CPU usage limits  Process timeouts  Idle  Ping  Shutdown / Startup  Web garden  Rapid-Fail protection  Process orphaning  Auto recycling 10
  • 11. www.devconnections.com IIS FOR DEVELOPERS APP POOL CONFIGURATION demo 11
  • 12. www.devconnections.com IIS FOR DEVELOPERS IIS FEATURES 12
  • 13. www.devconnections.com IIS FOR DEVELOPERS COMPRESS ME! 13 Compression Mode What does it do Considerations Dynamic Compress every response Uses CPU and memory Not cached Static Compress once and reuse Cached to disk Uses some CPU So turn it on, is that it? Almost!
  • 14. www.devconnections.com IIS FOR DEVELOPERS ASP.NET IIS OUTPUT CACHE  ASP.NET has one, IIS wanted one too  Not only for ASP.NET content  Supports varying by query/header  User/Kernel mode caching  Output can be statically compressed 14
  • 15. www.devconnections.com IIS FOR DEVELOPERS REWRITING URLS  Great tool for manipulating URLs  Can change incoming and outgoing URLs  URL transformation, redirection, or forwarding  Uses regular expressions and wildcards for pattern matching  Pre-conditions based on HTTP headers, URL parts, and server variables  And it has a UI !!!!! 15
  • 16. www.devconnections.com IIS FOR DEVELOPERS COMMON REWRITING SCENARIOS  Enforce lower-cased URLs  Add/remove trailing slash  Canonical hostnames  Prevent hotlinking  Friendly URLs  HTTPS redirection  Reverse proxy 16
  • 17. www.devconnections.com IIS FOR DEVELOPERS APPLICATION INITIALIZATION  Initial load of an application takes time  Dynamic compilation  Assembly loading  Execute Application_Start event  Application initialization to the rescue  Start your application after the worker process loads  Internally call code to initialize the system 17
  • 18. www.devconnections.com IIS FOR DEVELOPERS CONFIGURE INITIALIZATION 18 Application Pool Web Application <system.webServer> <applicationInitialization remapManagedRequestsTo="Warming.htm" skipManagedModules="true" > <add initializationPage="/init.ashx" /> </applicationInitialization> </system.webServer> Web.config
  • 19. www.devconnections.com IIS FOR DEVELOPERS 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 19
  • 20. www.devconnections.com IIS FOR DEVELOPERS IIS FEATURES demo 20
  • 21. www.devconnections.com IIS FOR DEVELOPERS LOGGING & TROUBLESHOOTING 21
  • 22. www.devconnections.com IIS FOR DEVELOPERS LOGGING  IIS logging is not enough!  Use the Advanced Logging module  http://bit.ly/iis-advanced-logging  Creates 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  Use your existing analysis tools 22 ADVANCED LOGGING
  • 23. www.devconnections.com IIS FOR DEVELOPERS 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  Creating too many request tracing files has its costs, beware of overuse  Investigate bad requests
  • 24. www.devconnections.com IIS FOR DEVELOPERS LOGGING & TROUBLESHOOTING demo 24
  • 25. www.devconnections.com IIS FOR DEVELOPERS IIS VS. IIS EXPRESS Feature IIS IIS Express Supported protocols HTTP, HTTPS, WCF (HTTP and non-HTTP) HTTP, HTTPS, WCF over HTTP Management tools IIS Manager, AppCmd, PowerShell AppCmd, Notepad Built-in common IIS modules Yes Yes Bitness 32/64 bit 32/64 bit (64 bit with IIS Express 8) Required Windows Edition IIS version specific Windows XP and up (IIS Express 8 - Vista and up) Security context Built-in/Domain user Current user 25
  • 26. www.devconnections.com IIS FOR DEVELOPERS IIS 8.5  Released with Windows Server 2012 R2  Some new cool features  Logging with ETW  Enhanced (advanced) logging  Worker process timeout suspension  Dynamic site configuration loading 26
  • 28. www.devconnections.com IIS FOR DEVELOPERS RESOURCES 28 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: sdrv.ms/15QPjke