Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iis 7.0, module order change

Tags:

asp.net

iis-7

"the entries cannot be reordered because one or more of them have been locked in the parent file "

in iis 7.0 manager when i try to change the order of modules in my application it gives this message.

how can i change the order of the modules ? is it possible?

like image 475
Yaya Avatar asked May 26 '09 12:05

Yaya


2 Answers

Can't you do it on Server level instead of site level?

like image 86
MartinHN Avatar answered Oct 21 '22 20:10

MartinHN


To change the order of modules for a site you first need to unlock the affected modules on the server level. Because you don't really know which modules are affected, I usually unlock them all. The easiest way to do this is with a PowerShell script (if you are still on IIS7, you need to download the PowerShell IIS snapin).

Save the following into text file: unlock-modules.ps1

 Import-Module WebAdministration

 Get-WebConfiguration `
 -pspath 'MACHINE/WEBROOT/APPHOST' `
 -filter "system.webServer/modules/add" -recurse | `
 where {$_.PSPath -eq 'MACHINE/WEBROOT/APPHOST' -and $_.Type -eq ''} `
 | foreach {         
     $filter = "system.webServer/modules/add[@name='" + $_.Name + "']"     
     Remove-WebConfigurationLock -pspath 'MACHINE/WEBROOT/APPHOST'  -filter $filter -verbose
 }

Open a PowerShell prompt as elevated administrator and run the script.

The script loops through all the modules at server level. Usually only the native modules (with and empty 'type' property) are locked. Unlock them all.

Now you can make changes to the order of the module at site level.

Be careful when the re-ordering, if you change the order of some of the system modules, IIS may no longer work in the expected way.

Also remember, that if you make changes to the modules at server level, the site will no longer inherit these and you have to apply them to the site level as well.

like image 39
Peter Hahndorf Avatar answered Oct 21 '22 20:10

Peter Hahndorf