Tutorial :How can one programmatically reorder Handler Mappings in IIS7?



Question:

We have an installation that creates a handler mapping for a website. Using the IIS7 Admin pack, I've come up with some jscript that sets this up successfully.

However, our developers have the requirement that this particular handler mapping be at the top of the ordered list of handler mappings. I discovered that you get to this view by right-clicking in the Handler Mappings list, and selecting "View Ordered List..."

I've been unable to discover how to programmatically specify the order in which my new Handler Mapping appears in this list.

Has anyone here done this before?

Cheers, Bryan


Solution:1

I tested this out. It appears that the only way to choose the order is to copy all inherited handlers and add your own (new) handlers to a web.config file at the site root, placing them in the order you would want them to be enabled.

You can find the default settings for handlers in System32\inetsrv\config\applicationHost.config by default.

That said, there may be better ways of controlling this by mapping your handlers more inteligently. Here are a couple of options using PHP as an example:

  1. create a map to *proc1.php that points to PHP4 CGI, create map to *proc5.php point it to the PHP5 cgi.
  2. Choose new file extensions for the new handlers (ie *.php4 and *.php5)

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »