Extremely simple operation! IIS site migration can be achieved in 3 minutes

Extremely simple operation! IIS site migration can be achieved in 3 minutes

To achieve load balancing or server migration, we may use multiple Web servers, which means we need to configure the same sites and application pools for multiple IIS. Do we need to rebuild them one by one according to the needs? Of course not! That would take a lot of time! We only need to execute some simple commands to export and import these configurations on IIS~

[[273805]]

When we create a site on IIS7 or IIS7.5, IIS will automatically create a unique application pool for the site. Therefore, if we want to import website information, we must first import application pool information; the following will introduce how to use the Windows built-in appcmd command to import and export the configuration of IIS sites and application pools to achieve IIS site migration.

Note: The appcmd command is in the C:\Windows\System32\inetsrv directory. When using the appcmd command, you need to enter this directory or add the directory to the Windows system environment variables.

Target server IIS environment creation

First, we need to install the IIS environment on the target server, and make it consistent with the IIS environment of the original server; the following takes this environment as an example to migrate the www and App sites.

IIS Application Pool and Site Export

1. Export IIS application pool configuration (specify application pool or all application pools)

Execute the following command in the Windows DOS window to export the IIS application pool:

  1. %windir%\system32\inetsrv\appcmd list apppool /config /xml > c:\allpools.xml

Among them, c:\allpools.xml is the exported IIS program pool configuration file, and the path can be changed as needed; after exporting, you can see the configuration file in the specified directory.

This command will export all IIS application pools on the server, but some of them are not needed and need to be deleted. For example: DefaultAppPool

You can use a file editor to open the exported IIS application pool configuration file allpools.xml and delete it.

Find the corresponding DefaultAppPool program pool configuration and delete it, starting with Ending content.

Export a single IIS application pool %windir%\system32\inetsrv\appcmd list apppool "www" /config /xml > c:\wwwpool.xml

2. Export IIS site configuration (specify site or sites)

Export all IIS sites

  1. %windir%\system32\inetsrv\appcmd list site /config /xml > c:\sites.xml

Similarly, after exporting all sites, there may be sites that we don’t need. We delete their configuration in the exported sites.xml: Default Web Site

Find the corresponding Default Web Site configuration and delete it. At the beginning, corresponding to this paragraph Ending content.

Exporting a Single IIS Site

  1. %windir%\system32\inetsrv\appcmd list site "www" /config /xml > c:\wwwwebsite.xml

IIS Application Pool and Site Import

The target server currently only has the default site of Default Web Site

1. Import IIS application pool configuration

First, copy the IIS application pool and site configuration files exported in the previous step to the target server.

Execute the following command to import the IIS application pool:

  1. %windir%\system32\inetsrv\appcmd add apppool /in <   c: \allpools.xml

Here the c:\allpools.xml path is changed to the path copied to the target server

If DefaultAppPool is not deleted in the configuration file exported above and the program pool exists on the target server, an error will occur during import.

Simply delete the corresponding duplicate application pool configuration files, or delete the duplicate application pool on the target server before importing it. The same is true for importing site configurations.

At this point, the application pools for the www and App sites have been successfully imported into the IIS of the target server.

Importing a single IIS application pool configuration

  1. %windir%\system32\inetsrv\appcmd list apppool "www" /config /xml > c:\wwwpool.xml

2. Import IIS site configuration

Importing IIS site configuration

  1. %windir%\system32\inetsrv\appcmd add site /in <   c: \sites.xml

In the era of cloud computing, an excellent operation and maintenance personnel not only needs to be brave enough to stand at the forefront of operation and maintenance accidents and have the ability to turn danger into safety; it also requires us to do a good job of real-time monitoring of the business and the ability to prevent problems before they occur.

<<:  Where is the entrance to 5G message service? You may not think of it

>>:  How to solve the packet loss problem in TCP transmission protocol

Recommend

How to implement TCP connection and communication with Python?

Network connection and communication are the know...

In the 5G era, will you still look for WiFi everywhere?

Watching short video apps like Tik Tok and Kuaish...

VirMach: $27.3/month-E3-1240v1/16GB/1TB/10TB/Los Angeles and other data centers

Last time, I shared the End of Life Plans series ...

What are the uses of 5G? How does 5G work?

5G is the present and the future, the next genera...

Want to know about 5G synaesthesia integration? Just read this article

Development Background Synaesthesia integration: ...

Wireless router, how many little secrets do you have?

Everyone has a wireless router at home. However, ...

Let JWT protect your API services

Hello everyone, I am Dayao. I have written an art...

The 5G digital era is coming. Recognize these 3 trends: seize new opportunities

Market development and technological progress com...

JuHost: Hong Kong VPS 40% off from $2.99/month, 1GB/20GB SSD/1TB@100Mbps

JuHost was registered in Hong Kong in early 2023,...