I want to make a dev, demo1, demo2 copy of the iis website I'm working on. I need each iis to run off its own code base, but the settings will be almost identical. Is there an easy way in windows 7 ultimate to clone my dev iis to a new site without having to completely reconfigure it? To configure the virtual directories for each iis takes 20 mins plus so this could save me a lot of work.
4 Answers
Take a look at the ApplicationHost.config file. It should be located under "c:\windows\system32\inetsrv\config". This is an XML file that contains all of the IIS configuration data. You can manually modify this file to quickly create copies of your website. Just make sure to make a backup first in case you have problems.
-
1Hah, yeah I had that thought but touching that file in my experience can be unpredictable. A clone functionality really sounds like something that should be supported. I'll back it up and take a crack at it though, thanks D. – Agile Noob Mar 15 '11 at 22:17
-
I love that I still come back here 10 years after the question was asked because I forgot how to do this. – Mike Devenney Jul 06 '21 at 19:37
Go to C:\Windows\system32\inetsrv\config
Make a copy of ApplicationHost.config
file. It's and XML file. Open it and go to <configuration><system.applicationHost><sites>
('configuration\system.applicationHost\sites
') find the site that you want to get duplicated (It will have same name as in IIS Management studio) then copy that site section and paste it below inside <sites>
then assign new site section new id and name attributes that have not been used yet name="Test1" id="5"
.
<site name="Test" id="4" serverAutoStart="true">
<application path="/" applicationPool="Test">
<virtualDirectory path="/" physicalPath="C:\OnTheMove\tags\Release 2.1.7.7\Offline\OfflineRouteHandler" userName="administrator" password="[enc:AesProvider:K0YvJ9r+XXNP8VUrZlbCPQ==:enc]" />
</application>
<application path="/Offline_Tablet" applicationPool="Test">
<virtualDirectory path="/" physicalPath="C:\OTM\Offline\OnTheMoveOffline" userName="administrator" password="[enc:AesProvider:tT9uIWQDtIZTRnSMmx8XmIQv0lr7AbUXcuGby5qRZSo=:enc]" />
</application>
<application path="/OnTheMoveWebFiles" applicationPool="Test">
<virtualDirectory path="/" physicalPath="C:\OTM\Offline\OnTheMoveOffline\OnTheMoveWebFiles" userName="administrator" password="[enc:AesProvider:zZgL59H6ka6jehb9BPTaNR8ogdgc8S90c3vf8p6MjPc=:enc]" />
</application>
<application path="/eai_enu" applicationPool="Test">
<virtualDirectory path="/" physicalPath="C:\OTM\Offline\OfflineRouteHandler" userName="administrator" password="[enc:AesProvider:MfaNJz14gaJK5EjgIqhj4w==:enc]" />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:80:" />
</bindings>
</site>
would get cloned to.
<site name="Test1" id="5" serverAutoStart="true">
<application path="/" applicationPool="Test">
<virtualDirectory path="/" physicalPath="C:\OnTheMove\tags\Release 2.1.7.7\Offline\OfflineRouteHandler" userName="administrator" password="[enc:AesProvider:K0YvJ9r+XXNP8VUrZlbCPQ==:enc]" />
</application>
<application path="/Offline_Tablet" applicationPool="Test">
<virtualDirectory path="/" physicalPath="C:\OTMTrunk\Offline\OnTheMoveOffline" userName="administrator" password="[enc:AesProvider:tT9uIWQDtIZTRnSMmx8XmIQv0lr7AbUXcuGby5qRZSo=:enc]" />
</application>
<application path="/OnTheMoveWebFiles" applicationPool="Test">
<virtualDirectory path="/" physicalPath="C:\OTMTrunk\Offline\OnTheMoveOffline\OnTheMoveWebFiles" userName="administrator" password="[enc:AesProvider:zZgL59H6ka6jehb9BPTaNR8ogdgc8S90c3vf8p6MjPc=:enc]" />
</application>
<application path="/eai_enu" applicationPool="Test">
<virtualDirectory path="/" physicalPath="C:\OTMTrunk\Offline\OfflineRouteHandler" userName="administrator" password="[enc:AesProvider:MfaNJz14gaJK5EjgIqhj4w==:enc]" />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:80:" />
</bindings>
</site>
Go to IIS Management studio and if you did everything right there will be new web site that is stopped.
If it fails use backup copy to overwrite ApplicationHost.config
.
UPDATE: As per comments if you are using 64bit environment when editing ApplicationHost.config
you want to use 64bit editor in Admin mode, Notepad is one.
Hope this saves you some time.

- 58,075
- 31
- 238
- 265
-
2Sounds like there are 2 copies of `ApplicationHost.config` in 64bit environments (under `system32` and `SysWOW64`), but they are linked to the same file. However, when I added the copies of the app pools and sites that I needed the clones of, nothing has changed in the IIS manager - no new pools, no new sites. – ajeh Mar 23 '16 at 17:06
-
3Same and that's completely crazy. On a 64 bit server, the only thing which works is editing the `system32\ApplicationHost.config` with the basic windows notepad. – BufferUnderRun May 04 '16 at 14:05
-
1To be more specific - you need a 64bit editor on a 64bit server. Otherwise, it won't update the changes. Reference: http://www.beacontechnologies.com/blog/2014/06/why-are-changes-to-my-applicaionhost-config-not-showing-up-in-iis/ – Jurijs Kastanovs May 10 '16 at 11:57
-
@JurijsKastanovs Thanks, added to answer - so it wouldn't be lost in comments. – Matas Vaitkevicius May 10 '16 at 12:34
Actually the answer above - editing the ApplicationHost.config is only half off the job. You will also need to add the new AppPools to the applicationPools node.
Therefore :
1/. As others have mentioned first make a copy of your ApplicationHost.config file !! I usually copy and rename as "ApplicationHost_BACKUP_YYYY_MM_DD.config"
2/. Using Notepad (best option for Windows to mitigate issues with 32 bit vs 64 bit). Search for the site to be copied looking for (in my case) 'id="13"'. Once you find the site you want to copy. Copy the entire node and paste it after the site node copied. Assign it a new ID. Be sure to check sites in IIS for all used IDs first !! Also be sure to give it a new NAME and update all PATHS and APPPOOLS in the copied section. See example below.
SITE TO COPY (CURRENT) :
<site name="Reading List" id="13" serverAutoStart="true">
<application path="/" applicationPool="Reading List">
<virtualDirectory path="/" physicalPath="C:\inetpub\wwwroot\reading_list\http" />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:80:readinglist.jsgroup.local" />
</bindings>
</site>
COPIED SITE (NEW) :
<site name="Reading List" id="14" serverAutoStart="true">
<application path="/" applicationPool="Reading List 2">
<virtualDirectory path="/" physicalPath="C:\inetpub\wwwroot\reading_list_2\http" />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:80:readinglist2.jsgroup.local" />
</bindings>
</site>
3/. Add new Apppools to the applicationPools node as configured in your copied site above i.e. below I have copied the "Reading List" apppool and renamed the copy "Reading List 2"
<applicationPools>
<add name="DefaultAppPool" autoStart="true" managedRuntimeVersion="v4.0">
<processModel identityType="ApplicationPoolIdentity" />
</add>
<add name="Reading List" autoStart="true" managedRuntimeVersion="v4.0" />
<add name="Reading List 2" autoStart="true" managedRuntimeVersion="v4.0" />
<!-- Other AppPools here -->
</applicationPools>
If all is well, view site in IIS and restart if need be :-)
Hope that helps someone.
Richard Hetherington

- 181
- 2
- 4
-
Also be aware there might be more settings to copy in applicationHost.config, such as `
How about copying the website using adsutil.vbs?
C:\Inetpub\AdminScripts> adsutil.vbs copy <source> <destination>
for example
C:\Inetpub\AdminScripts> adsutil.vbs copy w3svc/1 w3svc/556
The reason for the w3svc/
notation is more obvious if you execute adsutil.vbs ENUM /P W3SVC
first.
References:

- 562
- 5
- 29