Showing posts with label IIS. Show all posts
Showing posts with label IIS. Show all posts

Learn IIS 7 - IIS 7.x's Configuration System


Notes from Scott Forsyth's session "IIS 7.x's Configuration System" in his 52-week video lesson series  -

- IIS 7.x drastically different from IIS 6

- IIS 6 - IIS path (Metabase.xml) & .NET path (machine.config, web.config (root, site, app))

- Metabase.xml - app pools, site config, mime types, compression, various settings like default document

- 2 paths have merged & .NET becomes a first class citizen in IIS 7.x


- IIS 7.x - Distributed & Delegated Config system

- applicationHost.config (kind of replaces metabase.xml, guts of IIS) & administration.config (IIS Manager related settings) host most of the settings of IIS. Both files are in the %windir%\System32\inetsrv\config\ folder

- lot of settings related to not just .NET but also IIS config settings can live in the web.config or app web.config files

- Settings managed by IIS admin can also be managed by the development team as well.

- Feature Delegation - what settings are allowed to be applied in the config files vs. what has to be set at the global level. Every setting or config section has a decision on whether it is Read/Write- can't be delegated or whether it's read-only.

+ Benefits of Distributed Config
- Developers have more control of IIS settings - delegated management
- IIS configuration saved in source control
- Easier to maintain when migrating
- Websites packaged for consistent deployments - some settings may not work as they are not delegated

+ Gotcha's of Distributed Config
- Easy to overwrite existing settings
- AppDomain recycle
- Configuration is "all over the place" (aplicationHost.config, web.config files of site)
- Not replicated with shared config

- Lines are blurred between IIS & ASP.NET

Related: Getting Started with IIS Manager
Read More

Learn IIS7 with Scott Forsyth's 52-week video lesson series


IIS expert Scott Forsyth has been running a video lesson series where he shares best practices, technical processes, tools of the trade, and occasional stories from working in the trenches. 25 of the planned 52 weekly, roughly 10 minute sessions are hosted on YouTube and currently available for free viewing. I checked out the "AppDomain - What it is and Why it's Important" & "IIS Virtual Directory vs. Application" sessions & found them very informative. I've jotted down some material from there & I'll add more as I finish watching the rest -

* When to use Virtual Directory vs Application -
- Use Virtual Directory when you want to point to a different physical path, when you want to share a physical folder across sites.
+ Use Application when you want:
- New application root or
- AppDomain isolation or
- Subfolder to be in new application pool (2 folders of same site targetting different .NET Framework versions can be set to different app pools)

- A vDir pointing to a single physical path can be shared by 2 sites. While accessing files under that shared folder, it appears as if this vDir appears physically under it.

+ 4 types of IIS Folders (note the icons in the image)
- Normal Folder
- Application Folder - use "Convert to Application" in the context menu. Lets you change Application pool but not physical path
- vDir only Folder - shares same app domain & app pool as root site
- vDir with Application - vDir with seperate application boundary

- On removing an Application, physical path remains but references are lost.

- AppDomains are a boundary set up by ASP.NET; they are controlled by IIS

- Usually there is a 1:1 mapping between app & app pool

+ AppDomain recycle consequences -
- First hit perf penalty when
- Any info in that appdomain (like inproc sessions) is lost

+ AppDomain Recycle causes -
- App Pool Recycle/server reset/reboot
- Touching or modifying web.config
- Touching anything in an application folder (bin folder or any of the 7 ASP.NET special folders - App_Code etc)
- Adding/deleting folders
- IIS settings that affect app pool
- IIS settings that affect web.config (change to Default Document in IIS causes app recycle as this file is referenced in web.config)
- Root machine.config & web.config changes (but modifying applicationHost.config will have no impact)
- Some failures at AppPool or AppDomain level
Read More
Notes from Tech-Ed session "Internet Information Services (IIS) 7.5 for Developers"

Notes from Tech-Ed session "Internet Information Services (IIS) 7.5 for Developers"

Steve Evans' presentation "Internet Information Services (IIS) 7.5 for Developers" at Tech-Ed, NA 2011, had some interesting IIS tips & tricks. I transcribed some of them from the more than hour-long video recording on Channel9 -

- Developers have Swiss cheese knowledge – they know a lot but there are holes in what they are familiar with.

Certificates
- Certificate Authority (CA) creates a cert for a specific site & date range, the OS trusts it.
- Client connects to server, pulls down cert & check for 3 things -
* Certificate creator trusted?
* Host header matches?
* Date is in range?
- Configuring SSL certificates - A wildcard certificate can be used for multiple sites related to each other
- You can drop a non-CA issued cert into the Trusted Root Certification Authority to simulate a real scenario while experimenting with a feature

PowerShell
- strong support in IIS 7.5
- PowerShell treats IIS as a drive

DefaultDocument setting
- DefaultDocument setting within IIS Manager lets you specify the default file to return when a client does not request a specific file.
- Interesting IIS notification when I tried the DefaultDocument setting on an Application - "The file ‘default.aspx’ exists in the current directory. It is recommended that you move this file to the top of the list to improve performance"

Feature Delegation
- Feature Delegation module is used to configure the default delegation state for features at lower levels in IIS Manager
- web.config is created automatically when certain settings are added in IIS.
- we have the option in IIS to change which settings are stored in the web.config versus the IIS metabase. Its through Feature Delegation.
- if Feature Delegation is set to Read Only, the setting is stored in the IIS metabase

Application Pool- is where the code runs
- Managed pipeline mode setting for Application Pool has 2 options
* Integrated – ASP.NET is part of the pipeline
* Classic
- Be in Integrated mode whenever you can
- 10 year old codebase in ASP migrated to IIS 7.5 ran fine in Integrated mode
- Application Pool > Advanced Settings | General > “Enable 32-bit application”-false will address more than 4 gigs of memory
- Application Pool > Advanced Settings > Process Model | Idle timeout – set to 0 on Production server, default is 20 minutes
- Every 29 hours (Recycling | Regular time interval - 1740 minutes), the app pool will recycle (inproc sessions will be lost) no matter what
-Worker Processes module in IIS Manager lists all App pools
- Host rogue or crash-prone apps in a separate app pool so that it’s in a sandbox

Failed Request Tracing Rules
- configure tracing for failed requests. A request trace is logged either when an error status code is generated or when the time taken for the request exceeds a specified duration. If both conditions have been fulfilled, the first condition that is met willl generate the request trace.

Log Parser Lizard
- free GUI tool for MS Log Parser

MS Web Deploy /One Click deploy - available through command-line (MSDeploy.exe) & GUI
- Example: msdeploy -verb:sync -source:webServer -dest:webServer,computerName=demoiis -whatif - informs what would change on a sync but not actually change it.

Security
- After the Code Red security issue in IIS5, from IIS6 onwards components of IIS are disabled by default.
- URL Scan is built into IIS 7.

Web Platform Installer - app store for IIS

URL Rewrite - popular extension for IIS
- allows us to write rules to change the request coming in & going out on they fly
- comes with a bunch of pre-canned rules
- The sample rule UserFriendlyURL makes URLs SEO-friendly
- provides rewriting capabilities based on rules for the requested URL address & the content of an HTTP response. So if user types http://site2.com/ IIS can make it look as http://www.site2.com/
- You can rename URL Rewrite configured rules in web.config to have memorable names rather than using the automated default names.

IIS Express
- true IIS except it does not run as a service, it runs as a app under your user context.
- "Use IIS Express" appears in context menu for project in VS & you can switch from using Cassini to IIS Express. URL Rewrite, FRT, Log files (for use with Log Parser) available with IIS Express

Also see: Free videos from major Microsoft Developer events are archived on Channel9
Read More
HOW TO use IIS 7.5 on Windows XP, Vista with Visual Studio 2010

HOW TO use IIS 7.5 on Windows XP, Vista with Visual Studio 2010

The free download IIS Express brings the IIS 7.x feature-set to Windows XP SP2+ (which comes with IIS 5) & Windows Vista (which hosts IIS 7). With the upcoming Visual Studio 2010 SP1 (a beta is now available), enabling integration with IIS Express will be easy. IIS Express will bring the best of both existing web server options in Visual Studio - ASP.NET Development Server & the native IIS.

The advantages of IIS Express paraphrased from Scott Guthrie's post -
  • IIS Express will work with VS 2010 and Visual Web Developer 2010 Express, will run on Windows XP and higher systems, does not require an administrator account, and does not require any code changes to use. 

  • It’s lightweight and easy to install (less than 10Mb download and a super quick install)

  • It does not require an administrator account to run/debug applications from Visual Studio

  • It enables a full web-server feature set – including SSL, URL Rewrite, Media Support, and all other IIS 7.x modules

  • It supports and enables the same extensibility model and web.config file settings that IIS 7.x support

  • It can be installed side-by-side with the full IIS web server as well as the ASP.NET Development Server (they do not conflict at all)

  • It works on Windows XP and higher operating systems – giving you a full IIS 7.x developer feature-set on all OS platforms

  • It does not require any registration/configuration steps.

  • In addition to supporting ASP.NET, IIS Express also supports Classic ASP and other file-types and extensions supported by IIS.

IIS Express FAQ lists more of its features:
  •  IIS Express is the Web server that is included with WebMatrix. You can also install IIS Express all by itself 

  • You can also manually launch IIS Express from the command line and use it with Visual Studio 2008, using the custom web server option. 

  • Versions 2.0, 3.0, 3.5, and 4.0 of ASP.NET framework are supported.

  • IIS 7.5 Express supports 64-bit architectures using the WoW64 subsystem. Full 64-bit support will be considered for future releases.

  • The IIS 7.5 Express license allows the MSI to be redistributed. You can include the MSI in your product or chain your installer to it. You can't distribute IIS Express in any other manner at the moment.

  •  IIS Express supports both the “Integrated” and “Classic” managed pipeline modes from IIS 7.

  • The core IIS Express runtime is xcopy-deployable. However, as of this time, xcopy deployment is not an officially supported feature.

  •  By default, only requests over localhost are serviced; however, you can modify the bindings to enable external traffic. For security reasons, you should have Administrator user rights on the machine to set this up.

  •  IIS Express does not include an FTP service. 

  • Similar to IIS, IIS Express supports multiple applications under the same site running in the same process.

  •  IIS Express support WCF applications. As noted above, WCF is only supported over HTTP or HTTPS. WCF over MSMQ and net.tcp is not supported.

  • SharePoint won’t run on IIS Express because it uses IIS features that aren’t supported.

  • IIS Express can run side-by-side with other Web servers as long as there are no conflicting bindings. 

Read More
IIS vs Apache

IIS vs Apache

The Microsoft whitepaper (Word document) "Comparing IIS and Apache: Questions and Answers" published in March 2009 has interesting counter arguments on the long raging debate on which of the two is better. It answers the following questions -
  1. Does IIS offer the performance and scalability I need?
  2. Is IIS as secure as Apache?
  3. Is IIS harder to manage than Apache?
  4. Is IIS as reliable as Apache?
  5. Is IIS really as modular as Apache?
  6. Apache is an innovative platform. What about IIS?
  7. Troubleshooting Web applications can be complicated. What does IIS offer to simplify troubleshooting?
  8. I depend on a wide variety of Web architectures. Can I run them on IIS?
  9. Yes, PHP applications can run on IIS, but is it really a good idea?
  10. Will IIS be more expensive than Apache?
Also check Bill Staples' views on this topic.

Based on a survey of 205+ million sites, Netcraft reports that Apache has a 54% share in July 2010 while IIS has 26%. As a poster on Channel9 says, this may not be the true measure of popularity as it counts sites & not servers. The results could be skewed because domain registration & hosting sites park thousands of sites on one instance of Apache.
.
Read More

What is the difference between R2 & SP?

Like me, if you have wondered how the R2 in Windows Server 2008 R2 or SQL Server 2008 R2 differs from a SP (Service Pack), the freely download-able MS Press ebook "Introducing Windows Server 2008 R2" has a good explanation - An R2 release is more than an SP, but less than a full major release.

Beginning with Windows Server 2003, Microsoft moved to a server release cycle that was designed to have a major release every three to fve years (Windows Server 2003, Windows Server 2008), with a minor release at the approximate midpoint of the major release cycle (Windows Server 2003 R2, Windows Server 2008 R2). This change allowed Microsoft to move away from including new functionality in service packs (SPs), while
providing customers with a more stable and predictable server environment. 

An R2 release is more than an SP, but less than a full major release. Windows Server 2008 R2 includes Windows Server 2008 SP2, but it also adds many new features and functionality that were not part of Windows Server 2008.

The eBook has a chapter on IIS 7.5 that may be of interest to developers, especially those getting started with Sharepont 2010.

Also see:
What do CTP, RC, RTM, RTW mean?
45
Read More