How to copy/clone IIS7 website on local server?

Posted on 2012-08-24
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 12

    Expert Comment

    LVL 30

    Accepted Solution


    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

    Thank you! This solution worked for us.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    What Is Threat Intelligence?

    Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

    Suggested Solutions

    Title # Comments Views Activity
    * Windows Server 2012 Permissions Help * 16 54
    IIS Site Configuration Copy 2 59
    Use System DSN 6 62
    Security Certificate error 5 32
    Today I came across an interesting issue that had me pulling my hair out.  I was troubleshooting a new internal web site which uses integrated security instead of anonymous.  When browsing the site from my laptop, I was able to access it with no iss…
    If you don't have the right permissions set for your WordPress location in IIS, you won't be able to perform automatic updates. Here's how to fix the problem.
    how to add IIS SMTP to handle application/Scanner relays into office 365.
    In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor ( If you're interested in additional methods for monitoring bandwidt…

    737 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

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now