Documentation Center

Configuring IIS applicationHost.Config

This part describes which actions should be taken to change the applicationHost.Config to allow the definition of website-specific settings in the Web.config file for Content Manager websites and to set the necessary mimetype definitions for compression.

Before you begin

The steps for configuring IIS web services must have been executed, especially the static and dynamic compression feature for IIS needs to be installed.

About this task

The ApplicationHost.config file can be found in the folder %WINDIR%\system32\inetsrv\config. It is the root file of the configuration system when you are using IIS 7 and above. It includes definitions of all sites, applications, virtual directories and application pools, as well as global defaults for the web server settings. It has definitions for locking-down most IIS sections to the global level, so that by default they cannot be overridden by lower-level Web.config files in the hierarchy. To make configuration easier, we will unlock some of these global level settings, so we can define these settings in the Web.config file forContent Manager websites.

Procedure

  1. Make the necessary changes to allow the definition of website specific settings in the Web.config file for the website.
    1. Start cmd.exe as Administrator.
    2. Execute the following statements in the cmd window:
      %windir%\system32\inetsrv\appcmd unlock config /section:system.webServer/serverRuntime /commit:apphost
      %windir%\system32\inetsrv\appcmd unlock config /section:system.webServer/defaultDocument /commit:apphost
      %windir%\system32\inetsrv\appcmd unlock config /section:system.webServer/staticContent /commit:apphost
      %windir%\system32\inetsrv\appcmd unlock config /section:system.webServer/directoryBrowse /commit:apphost
      %windir%\system32\inetsrv\appcmd unlock config /section:system.webServer/handlers /commit:apphost
      %windir%\system32\inetsrv\appcmd unlock config /section:system.webServer/urlCompression /commit:apphost
  2. Set the necessary mimetype definitions for static compression:
    1. Start 64-bit PowerShell as Administrator.
    2. Execute the following statements in the PowerShell window:
      Set-ExecutionPolicy Unrestricted -Force
      
      [Environment]::Is64BitProcess
      
      Import-Module WebAdministration
      
      # Define the mimetypes for IIS that can be statically compressed
      $staticcompression = @(
      	@{mimeType='text/*'; enabled='True'},
      	@{mimeType='message/*'; enabled='True'},
      	@{mimeType='application/x-javascript'; enabled='True'},
      	@{mimeType='application/atom+xml'; enabled='True'},
      	@{mimeType='application/xaml+xml'; enabled='True'},
       @{mimeType='application/octet-stream'; enabled='True'},
      	@{mimeType='*/*'; enabled='False'}
      )
      # Set the specified static mimetypes in the compression settings
      # in applicationHost.config
      $filter = 'system.webServer/httpCompression/statictypes'
      Set-Webconfiguration -Filter $filter -Value $staticcompression						
      							
  3. Set the necessary mimetype definitions for dynamic compression:
    1. Start 64-bit PowerShell as Administrator.
    2. Execute the following statements in the PowerShell window:
      Set-ExecutionPolicy Unrestricted -Force
      
      [Environment]::Is64BitProcess
      
      Import-Module WebAdministration
      
      # Define the mimetypes for IIS that can be dynamically compressed
      $dynamiccompression = @(
      	@{mimeType='text/*'; enabled='True'},
      	@{mimeType='message/*'; enabled='True'},
      	@{mimeType='application/x-javascript'; enabled='True'},
      	@{mimeType='application/soap+xml'; enabled='True'},
      	@{mimeType='application/xml'; enabled='True'},
      	@{mimeType='application/json'; enabled='True'},
       @{mimeType='application/octet-stream'; enabled='True'},
      	@{mimeType='*/*'; enabled='False'}	
      )
      # Set the specified dynamic mimetypes in the compression settings 
      # in applicationHost.config
      $filter = 'system.webServer/httpCompression/dynamictypes'
      Set-Webconfiguration -Filter $filter -Value $dynamiccompression
      # Note that compression can be set per web.config file
    3. Close PowerShell.