You are here

Migrating sites from IIS7 to IIS8.5


Hello. I was given the next task - to migrate the sites that are hosted on Windows 2008 to Windows 2012R2. Difficulties turned out to be that every site revolves on a separate application pool, from an individual user whose password is not known. Sites are pretty much and almost all have different settings (isapi filters, etc.). If you transfer using WebDeploy, then at least users will not be saved.

Below I will tell you how to migrate sites with IIS7 to IIS8.5 as transparently as possible for clients.

First, you need to put all the IIS modules and programs related to IIS work (for example, asp upload, asp jpeg, etc.).

Let's go - unload the application pools and sites using commands, having previously created the migration folder on C: \

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

Next, you need to copy into this folder the file applicationHost.config which located at C:\Windows\System3\inetsrv\config

After that, go to the new server and copy the migration folder from the old server to the new one on drive C.

Next, you need to edit the appools.xml and sites.xml files. I decided that it would be better to transfer sites one at a time, which would be less confusing and easier in case of what it was to roll back, even though it took a very long time, none of the clients eventually noticed the transfer.

In general, in appools.xml we search for all the sections associated with the application pool of the site, and leave only them, the remaining partitions are deleted. There should be something like:

<?xml version="1.0" encoding="UTF-8"?>
<appcmd>
  <APPPOOL APPPOOL.NAME="test.mytechnote.ru v2.0 (Classic)" PipelineMode="Classic" RuntimeVersion="v2.0" state="Started">
        <add name="test.mytechnote.ru v2.0 (Classic)" autoStart="true" enable32BitAppOnWin64="true" managedRuntimeVersion="v2.0" managedPipelineMode="Classic">
            <processModel identityType="SpecificUser" userName="domain\testsanglybru_web" password="123123" />
            <recycling>
                <periodicRestart>
                    <schedule>
                    </schedule>
                </periodicRestart>
            </recycling>
            <failure />
            <cpu />
        </add>
    </APPPOOL>
    <APPPOOL APPPOOL.NAME="test.mytechnote.ru v4.0 (Classic)" PipelineMode="Classic" RuntimeVersion="v4.0" state="Started">
        <add name="test.mytechnote.ru v2.0 (Integrated)" autoStart="true" enable32BitAppOnWin64="true" managedRuntimeVersion="v2.0" managedPipelineMode="Integrated">
            <processModel identityType="SpecificUser" userName="exch.zone\testsanglybru_web" password="As12345^" />
            <recycling>
                <periodicRestart>
                    <schedule>
                    </schedule>
                </periodicRestart>
            </recycling>
            <failure />
            <cpu />
        </add>
    </APPPOOL>
</appcmd>

Similarly we do in sites.xml:

<?xml version="1.0" encoding="UTF-8"?>
<appcmd>
    <SITE SITE.NAME="test.mytechnote.ru" SITE.ID="132" bindings="http/192.168.1.101:80:test.mytechnote.ru,http/192.168.1.101:80:www2.test.mytechnote.ru" state="Stopped">
        <site name="test.mytechnote.ru" id="132" serverAutoStart="false">
            <bindings>
                <binding protocol="http" bindingInformation="192.168.1.101:80:test.mytechnote.ru" />
                <binding protocol="http" bindingInformation="192.168.1.101:80:www2.test.mytechnote.ru" />
            </bindings>
            <limits />
            <logFile directory="D:\iis\test.mytechnote.ru\logs" enabled="true" />
            <traceFailedRequestsLogging />
            <applicationDefaults />
            <virtualDirectoryDefaults />
            <ftpServer>
                <connections />
                <security>
                    <dataChannelSecurity />
                    <commandFiltering>
                    </commandFiltering>
                    <ssl />
                    <sslClientCertificates />
                    <authentication>
                        <anonymousAuthentication />
                        <basicAuthentication />
                        <clientCertAuthentication />
                        <customAuthentication>
                            <providers>
                            </providers>
                        </customAuthentication>
                    </authentication>
                </security>
                <customFeatures>
                    <providers>
                    </providers>
                </customFeatures>
                <messages />
                <fileHandling />
                <firewallSupport />
                <userIsolation>
                    <activeDirectory />
                </userIsolation>
                <directoryBrowse />
                <logFile />
            </ftpServer>
            <application path="/" applicationPool="test.mytechnote.ru v4.0 (Classic)">
                <virtualDirectoryDefaults />
                <virtualDirectory path="/" physicalPath="D:\HostingSpaces\Glybin\test.mytechnote.ru\wwwroot" />
            </application>
            <application path="/test" applicationPool="test.mytechnote.ru v4.0 (Integrated)">
                <virtualDirectoryDefaults />
                <virtualDirectory path="/" physicalPath="D:\iis\test.mytechnote.ru" />
            </application>
        </site>
    </SITE>
</appcmd>

After that, we import the application pool and site into a new IIS:

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

There should not be any errors, if there are, check the correctness of your xml files.

Next, you need to edit the file C:\Windows\System32\inetsrv\config\applicationHost.config, without forgetting to make backup of this file.

In it, at the very end before the closing </configuration> tag, you need to add the Location sections for the transferred site. We take them from the file applicationHost.config from the old server (from the migration folder).

An example of those sections:

    <location path="test.mytechnote.ru">
        <system.webServer>
            <security>
                <authentication>
                    <anonymousAuthentication enabled="true" userName="domain\testsanglybru_web" password="[enc:AesProvider:j81Zp74EwpfGryPqjoIIiCtxMDe/bm4VOFiYr9ojQSV8OM10NNbJECi7zD62KDcGWLzRJNGkzihpACVhb5GZ4qESxEkVkyPDVwwUdqXkTnL4u2ZUEyJcizrz5MaY5RGw:enc]" />
                    <windowsAuthentication enabled="false" />
                    <basicAuthentication enabled="false" />
                </authentication>
            </security>
            <asp enableParentPaths="false" />
            <handlers>
                <add name="ASPClassic (*.htr)" path="*.htr" verb="GET,HEAD,POST,DEBUG" modules="IsapiModule" scriptProcessor="C:\Windows\system32\inetsrv\asp.dll" resourceType="File" />
                <add name="ASPClassic (*.cdx)" path="*.cdx" verb="GET,HEAD,POST,DEBUG" modules="IsapiModule" scriptProcessor="C:\Windows\system32\inetsrv\asp.dll" resourceType="File" />
                <add name="ASPClassic (*.asa)" path="*.asa" verb="GET,HEAD,POST,DEBUG" modules="IsapiModule" scriptProcessor="C:\Windows\system32\inetsrv\asp.dll" resourceType="File" />
            </handlers>
            <httpProtocol>
                <customHeaders>
                    <clear />
                    <add name="X-Powered-By" value="ASP.NET" />
                </customHeaders>
            </httpProtocol>
            <modules>
            </modules>
        </system.webServer>
    </location>
    <location path="Default FTP Site/glybin">
        <system.ftpServer>
            <security>
                <authorization>
                    <remove users="*" roles="" permissions="Read" />
                    <add accessType="Allow" users="glybin" permissions="Read, Write" />
                </authorization>
            </security>
        </system.ftpServer>
    </location>
    <location path="test.mytechnote.ru/test">
        <system.webServer>
            <security>
                <authentication>
                    <anonymousAuthentication enabled="true" userName="domain\testsanglybru_web" password="[enc:AesProvider:r5xxe/2LEJGXA2TT8Gz/nxiswNFHzcCn3riax9+CT5iOECEVTscfFemAC9OdOuP0bnXV5WaRwX4HyxNDbGlw+rOXPtQrk6W+Z5sQPnZdWeeY8f/06IJCiUF6TyszIaQ0:enc]" />
                    <windowsAuthentication enabled="true" />
                    <basicAuthentication enabled="false" />
                </authentication>
            </security>
            <asp enableParentPaths="false" />
            <handlers>
                <remove name="ASPClassic (*.htr)" />
                <remove name="SecurityCertificate" />
                <remove name="ASPClassic (*.cdx)" />
                <remove name="ASPClassic" />
                <remove name="ASPClassic (*.asa)" />
            </handlers>
        </system.webServer>
    </location>

They also need to be changed in the sinks where the encrypted password is set to open, you can see the open password in the file appools.xml, in my case, you need to change the lines

<anonymousAuthentication enabled="true" userName="domain\testsanglybru_web" password="[enc:AesProvider:r5xxe/2LEJGXA2TT8Gz/nxiswNFHzcCn3riax9+CT5iOECEVTscfFemAC9OdOuP0bnXV5WaRwX4HyxNDbGlw+rOXPtQrk6W+Z5sQPnZdWeeY8f/06IJCiUF6TyszIaQ0:enc]" />

to

<anonymousAuthentication enabled="true" userName="domain\testsanglybru_web" password="123123" />

This completes the editing of the configs. Now you need to copy the site files to the new server, the folder structure should be saved (that is, if the site was on the old server in the D:\sites folder, then on the new one it should be also there).

After the files are copied, go to the IIS Manager, go to our site and check the settings, you need to go to different sub-items and make sure that IIS does not swear at anything.

Next, we register a new server address in the hosts file on your computer. We detach the site in the browser. I specifically wrote that you need to open a site in the browser before changing the bindings in the settings of the site, to make sure that we went to the correct server. In general, the default site should open.

After that, you need to go to the settings of our site and change the bindings.

Again, go to the browser on our computer and update the site, we should open our site on the new server. We check that everything would work (it's convenient to use Chrome with the developer mode enabled). If everything works then we change records on DNS servers, everything is ready. After the DNSs are updated, you can stop the site on the old server.

And I also mentioned asp upload, they use the addition of header-Content-Length in the examples. In the new version of IIS it is not supported, it needs to be changed to Content-Size wherever it occurs, if someone uses asp upload.

0 0

Share the article with your friends in social networks, maybe it will be useful to them.


If the article helped you, you can >>thank the author<<