IIS: Powershell or appcmd command to reset IIS site's handler mapping to the parent [Answered]RSS

3 replies

Last post Apr 04, 2016 06:43 AM by Jean Sun

  • IIS: Powershell or appcmd command to reset IIS site's handler mapping to the parent

    Mar 29, 2016 04:10 PM|websolut|LINK

    While automating IIS site deployments we are stuck with automating such simple operation as 'revert handlers to the parent' (IIS 7.5).

    We found this 

        Set-Location IIS:\sites\$Site
        clear-WebConfiguration -filter /system.webserver/handlers -force

    But this does not work when one changes apppool from .net2 to .net4 and tries to revert the handlers.

    A lot of resources refer to a c# script but I think it is also outdated.

    Thanks.

  • Re: IIS: Powershell or appcmd command to reset IIS site's handler mapping to the parent

    Mar 30, 2016 08:30 AM|Jean Sun|LINK

    Hi,

    Can you revert handlers to parent using the UI (IIS Manager -> Handler Mappings -> Action Pane -> Revert to Inherited)?

    Best Regards,
    Jean

    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue.
    If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.
  • Re: IIS: Powershell or appcmd command to reset IIS site's handler mapping to the parent

    Apr 03, 2016 01:14 AM|websolut|LINK

    We are looking into an automation solution.

  • Re: IIS: Powershell or appcmd command to reset IIS site's handler mapping to the parent

    Apr 04, 2016 06:43 AM|Jean Sun|LINK

    Hi,

    The Syntax of Clear-Configuration is:

    Clear-WebConfiguration [-Force] [-Location <String[]>] [-Filter] <String[]> [[-PSPath] <String[]>] [-WarningAction <ActionPreference>] [-WarningVariable <String>] [-WhatIf] [-Confirm] [<CommonParameters>]
    

    Please change your command to:

    Clear-WebConfiguration -Filter /system.webServer/handlers -PSPath 'IIS:\sites\$Site' -force

    Best Regards,

    Jean

    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue.
    If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.