Saving website level rewrite rules to applicationHost.config

Is it possible to save rewrite rules configured on the level of a website to the applicationHost.config, while using IIS Manager? (I know how to do that manually)
By default they are saved to Web.config file.
I need it to get rules deployed to other servers by MSDeploy tool.


Solution 1:

Yes it is possible to do this but you won't have all the nice UI features that the URL Rewrite applet has.

On the main features view for your site there's an icon marked "Configuration Editor", double click to open:

enter image description here

There are two drop down boxes named Section and From:.

The Section dropdown allows you to choose which configuration section you want to edit. It opens up a tree view.

The From: dropdown allows you to choose whether to change the setting in the site's web.config file or in a <location> element in the applicationHost.config file:

enter image description here

The UI is driven from the raw schema data stored in:

C:\Windows\System32\inetsrv\config\schema

It's fairly "no-frills" but does expose some configuration elements/attributes that some of the configuration feature applets sometimes don't show.

Even though fairly basic, it's safer to use this on a production server rather than hacking away at applicationHost.config directly because you can be guaranteed that you're putting settings in the right place, using the correct enumeration values and are at less risk from finger trouble.