Changes Between IIS6 and IIS7
Product version: |
EPiServer CMS 5 R2 |
---|---|
Document version: |
1.0 |
Document last saved: |
26-09-2008 |
Introduction
In IIS7, Microsoft introduced integrated pipelines, which basically fixes the problems in IIS6 with two pipelines (one for ASP.NET and one for IIS). To make it simple for developers to run their applications in IIS7, they added an alternative to integrated pipelines, called classic pipeline, which basically is what it says, the old pipeline from IIS6. This means that old applications can run as before without any changes in the web.config with the classic pipeline, but with one big disadvantage. By using classic pipeline, some of the new features in IIS7 will not work therefore we strongly recommend IIS7 in integrated pipeline mode.
Table of Contents
- Change between integrated mode and classic mode
- IIS7 Changes in web.config
- Changes in web.config - EPiServer CMS 5 R2
» Configuration/System.web/httpModules
» Configuration/System.web/httpHandlers
» Configuration/location path=”[virtual path provider]”
» Configuration/location path=”[UI]”
» Configuration/location path=”WebServices”
» Configuration/location path=”util”
» Configuration/location path=”App_Themes/Default” - Migration Tool
Change between integrated mode and classic mode
To make a change in IIS7 between integrated pipeline and classic pipeline, go to the application pools and open the application pool that your site is using. In the dropdownlist, choose the mode you want - for an EPiServer site you should choose the integrated mode.
IIS7 Changes in web.config
In IIS7, with integrated pipelines, the “httpModules” and “httpHandlers” have been changed. To make a site work in integrated mode, some changes have to be made.
First of all, the “httpModules” and “httpHandlers” have changed their names to modules and handlers. Secondly, they´ve been moved from the “system.web” element to the “system.webServer” element. To make the module elements work, basically move it from the “system.web” to “system.webserver”. To make the handler elements work you also have to add a name attribute to every handler, if not, you will receive an error message. For the handler root element, it´s also possible to add an access policy attribute (accessPolicy) to specify the access policys. This attribute is optional.
To make your site work in integrated mode and classic mode, turn off the integrated mode validation by adding an element called “validation” with the attribute “validateIntegratedModeConfiguration” under “system.webserver”. Set the attribute value to “false”.
Special attribute
In IIS7, some new features were introduced that optimize the requests. One of them is “ManageHandler precondition” which optimize the performance of requests when no managed code needs to be involved.
Classic mode (IIS6):
<system.web>
<httpModules>
<add name=”WorkflowRuntime” type=”EPiServer.
Web.InitializationModule, EPiServer” />
</httpModules>
<httpHandlers>
<add verb=”Get” path=”WebResource.axd”
type=”System.Web.Handlers.AssemblyResourceLoader” />
</httpHandlers>
</system.web>
Integrated mode (IIS7):
<system.webServer>
<modules>
<add name=”WorkflowRuntime” type=”EPiServer.Web.
InitializationModule, EPiServer” />
</modules>
<handlers>
<add name=”webresources” verb=”Get” path=”WebResource.axd”
type=”System.
Web.Handlers.AssemblyResourceLoader” />
</handlers>
</system.webServer>
Changes in web.config - EPiServer CMS 5 R2
When migrating an EPiServer site to use IIS7 in integrated mode, there are several places in web.config that need be changed in order to make the site run correctly.
We have introduced a change in EPiServer CMS 5 R2 in the static file handler. Because of this, the web.config needs to be changed to use the native “StaticFileHandler” to take care of all static files not delivered by any of the configured virtual path providers.
Configuration/System.web/httpModules
This section has been moved to Configuration/System.webServer/modules. On the root element for modules, we have added the attribute “runAllManagedModulesForAllRequests”, and for every added module we added the attribute “precondition” with the value “managedHandler”.<system.webServer>
<modules runAllManagedModulesForAllRequests="true">
<add name="InitializationModule" type="EPiServer.Web.
InitializationModule, EPiServer"
preCondition="managedHandler"/>
<add name="Initializer"
type="EPiServer.Scheduler.Initializer,
EPiServer.Scheduler" preCondition="managedHandler" />
<add name="WorkflowRuntime"
type="EPiServer.WorkflowFoundation.
WorkflowSystem, EPiServer.WorkflowFoundation"
preCondition="managedHandler" />
<add name="UrlRewriteModule"
type="EPiServer.Web.UrlRewriteModule,
EPiServer" preCondition="managedHandler" />
</modules>
</system.webServer>
Configuration/System.web/httpHandlers
The elements in this section have been changed. In the new elements: system.webServer/handlers, we have replaced the wildcard handler that uses EPiServer.Web.StaticFileHandler with the built-in StaticFileHandler. At the bottom of the node EPiServer.Web.StaticFileHandler registration has been added. Click here to view the elements.
Configuration/location path=”[virtual path provider]”
The system.web/httpHandlers have been changed to system.webServer/handlers. The elements have been named “Webresources” respective “wildcard”.
<location path="PageFiles">
<staticFile expirationTime="-1.0:0:0" />
<system.webServer>
<handlers>
<add name="webresources" path="WebResource.axd" verb="GET"
type="System.Web.Handlers.AssemblyResourceLoader" />
<add name="wildcard" path="*" verb="*"
type="EPiServer.Web.StaticFileHandler, EPiServer" />
</handlers>
</system.webServer>
</location>
Configuration/location path=”[UI]”
Nothing is removed in this element, but we added the system.webServer/handlers element with some built-in handlers. At the bottom we use EPiServer.Web.StaticFileHandler as wildcard.<location path="myui">
<system.web>
…
</system.web>
<system.webServer>
<handlers>
<clear />
<add name="webresources" path="WebResource.axd" verb="GET"
type="System.Web.Handlers.AssemblyResourceLoader" />
<add name="PageHandlerFactory-Integrated"
path="*.aspx" verb="GET,HEAD,POST,DEBUG"
type="System.Web.UI.PageHandlerFactory"
modules="ManagedPipelineHandler" scriptProcessor=""
resourceType="Unspecified" requireAccess="Script"
allowPathInfo="false" preCondition="integratedMode"
responseBufferLimit="4194304" />
<add name="SimpleHandlerFactory-Integrated"
path="*.ashx" verb="GET,HEAD,POST,DEBUG"
type="System.Web.UI.SimpleHandlerFactory"
modules="ManagedPipelineHandler" scriptProcessor=""
resourceType="Unspecified" requireAccess="Script"
allowPathInfo="false" preCondition="integratedMode"
responseBufferLimit="4194304" />
<add name="WebServiceHandlerFactory-Integrated"
path="*.asmx" verb="GET,HEAD,POST,DEBUG"
type="System.Web.Services.Protocols
.WebServiceHandlerFactory,
System.Web.Services, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a"
modules="ManagedPipelineHandler" scriptProcessor=""
resourceType="Unspecified" requireAccess="Script"
allowPathInfo="false" preCondition="integratedMode"
responseBufferLimit="4194304" />
<add name="wildcard" path="*"
verb="*" type="EPiServer.Web.StaticFileHandler,
EPiServer" />
</handlers>
</system.webServer>
</location>
Configuration/location path=”WebServices”
Nothing is removed in this element, though the system.webServer/handlers element with some built-in handlers has been added. Further down you can see that EPiServer.Web.StaticFileHandler as wildcard has been used.<location path="WebServices">
<episerver.basicAuthentication sendBasicChallenge="true" basicRealm="" />
<system.web>
…
</system.web>
<system.webServer>
<handlers>
<clear />
<add name="webresources"
path="WebResource.axd" verb="GET"
type="System.Web.Handlers.AssemblyResourceLoader"
<add name="WebServiceHandlerFactory-Integrated"
path="*.asmx" verb="GET,HEAD,POST,DEBUG"
type="System.Web.Services.Protocols.WebServiceHandlerFactory,
System.Web.Services, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a"
modules="ManagedPipelineHandler"
scriptProcessor="" resourceType="Unspecified"
requireAccess="Script"
allowPathInfo="false" preCondition="integratedMode"
responseBufferLimit="4194304" />
<add name="wildcard" path="*"
verb="*" type="EPiServer.Web.StaticFileHandler,
EPiServer" />
</handlers>
</system.webServer>
</location>
Configuration/location path=”util”
Nothing is removed in this element, though the system.webServer/handlers element with some built-in handlers has been added. Further down we use EPiServer.Web.StaticFileHandler as wildcard.<location path="util">
<system.web>
…
</system.web>
<system.webServer>
<handlers>
<clear />
<add name="webresources" path="WebResource.axd" verb="GET"
type="System.Web.Handlers.AssemblyResourceLoader" />
<add name="PageHandlerFactory-Integrated"
path="*.aspx" verb="GET,HEAD,POST,DEBUG"
type="System.Web.UI.PageHandlerFactory"
modules="ManagedPipelineHandler"
scriptProcessor="" resourceType="Unspecified"
requireAccess="Script"
allowPathInfo="false" preCondition="integratedMode"
responseBufferLimit="4194304" />
<add name="SimpleHandlerFactory-Integrated"
path="*.ashx" verb="GET,HEAD,POST,DEBUG"
type="System.Web.UI.SimpleHandlerFactory"
modules="ManagedPipelineHandler"
scriptProcessor="" resourceType="Unspecified"
requireAccess="Script"
allowPathInfo="false" preCondition="integratedMode"
responseBufferLimit="4194304" />
<add name="WebServiceHandlerFactory-Integrated"
path="*.asmx" verb="GET,HEAD,POST,DEBUG"
type="System.Web.Services.Protocols.
WebServiceHandlerFactory,
System.Web.Services, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a"
modules="ManagedPipelineHandler"
scriptProcessor="" resourceType="Unspecified"
requireAccess="Script"
allowPathInfo="false" preCondition="integratedMode"
responseBufferLimit="4194304" />
<add name="wildcard" path="*" verb="*"
type="EPiServer.Web.StaticFileHandler, EPiServer" />
</handlers>
</system.webServer>
</location >
Configuration/location path=”App_Themes/Default”
This is a new element, only containing the EPiServer static file handler as wildcard.<location path="App_Themes/Default">
<system.webServer>
<handlers>
<clear />
<add name="wildcard" path="*" verb="*"
type="EPiServer.Web.StaticFileHandler, EPiServer" />
</handlers>
</system.webServer>
</location>
Web.config Migration Tool
It is possible to make an easy migration of the web.config to support IIS7 by running a command called Appcmd like this: “%windir%\system32\inetsrv\Appcmd migrate config ‘<ApplicationPath>’ “. Example “C:\Windows\System32\inetsrv\Appcmd migrate config ‘Default Web Site/Main’”.