Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


How to copy/clone IIS7 website on local server?

Posted on 2012-08-24
Medium Priority
Last Modified: 2012-08-28
I have an existing IIS7 website that I would like to clone and have it be on the same local server. So I would have 2 identical sites that have different Site IDs (running off different IPs/ports).
I've tried to export the shared configuration & import, but that only replaces the current sites instead of adding a new one (even if I change the existing Site ID before the import). I've also seen suggestions to modify the \windows\system32\inetsrv\config\applicationHost.config file, but I'm not familiar enough w/ the file to make the appropriate changes.

Any help would be appreciated. Thanks.
Question by:mlhd
LVL 30

Accepted Solution

Brad Howe earned 2000 total points
ID: 38336567

You are correct, you can do this simply my stop IIS Services and modifying the %windir%\system32\inetsrv\applicaitonhost.config file.

Backup existing applicationhost.config

1. Open CMD
2. %windir%\system32\inetsrv\appcmd.exe add backup "PRE-CLONE-BACKUP"

Clone Site
1. open NOTEPAD as "RUN AS ADMINISTRATOR" context.
2. FILE | OPEN %windir%\system32\inetsrv\applicationhost.config
3. Search for <Sites>
   - Here you will see something similar to below.

            <site name="My Site X" id="2321" serverAutoStart="true">
                <application path="/" applicationPool="test">
                    <virtualDirectory path="/" physicalPath="D:\inetpub\wwwroot" />
                    <binding protocol="http" bindingInformation="*:80:" />
                <logFile logFormat="W3C" directory="%SystemDrive%\inetpub\logs\LogFiles" />
                <traceFailedRequestsLogging directory="%SystemDrive%\inetpub\logs\FailedReqLogFiles" />
            <applicationDefaults applicationPool="DefaultAppPool" />
            <virtualDirectoryDefaults allowSubDirConfig="true" />

4. Find you site config, Copy and modify. You only need the <site> </site> section.

            <site name="CLONE - My Site X" id="2322" serverAutoStart="true">
                <application path="/" applicationPool="test">
                    <virtualDirectory path="/" physicalPath="D:\inetpub\wwwroot2" />
                    <binding protocol="http" bindingInformation="*:8080:" />

5. Start IIS Services and verify.

New site should be up and running now under http://server.ip.addr:8080

If required
To restore that backup, run this command:
%windir%\system32\inetsrv\appcmd.exe restore backup "PRE-CLONE-BACKUP"


Author Closing Comment

ID: 38343777
Thank you! This solution worked for us.

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Here are the symptoms: You start receiving calls from users that one of your legacy web apps isn't coming up, so you log into your IIS 5 server to check it out.  When you pull up the services, you notice that the WWW Publishing service isn't runn…
Lync server 2013 or Skype for business Backup Service Error ID 4049 – After File Share Migration
Integration Management Part 2
Screencast - Getting to Know the Pipeline
Suggested Courses

571 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question