Migrating IIS 6.0 Web Application to New Version Guidance Migrating Web Application from IIS6.0 to IIS7.x and above Michael Li (PFE) PFE micl@microsoft.com Prepared for Users who want to upgrade IIS 6.0 to IIS 7.0 and above Thursday, 17 July 2014 Version 1.2 Template MICROSOFT CONFIDENTIAL. FOR INTERNAL USE ONLY. The information contained in this document represents the current view of Microsoft Corporation on the issues discussed as of the date of publication and is subject to change at any time without notice to you. This document and its contents are provided AS IS without warranty of any kind, and should not be interpreted as an offer or commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information presented. The information in this document represents the current view of Microsoft on the content. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED, OR STATUTORY, AS TO THE INFORMATION IN THIS DOCUMENT. The example companies, organizations, products, domain names, e-mail addresses, logos, people, places, and events depicted herein are fictitious. No association with any real company, organization, product, domain name, email address, logo, person, places, or events is intended or should be interred. Code snippets, samples, or examples contained in this document are provided AS-IS without warranties of any kind. Do not distribute. The descriptions of other companies’ products in this document, if any, are provided only as a convenience to you. Any such references should not be considered an endorsement of support by Microsoft. Microsoft cannot guarantee their accuracy, and the products may change over time. Also, the descriptions are intended as brief highlights to aid understanding, rather than as thorough coverage. For authoritative descriptions of these products, please consult their respective manufacturers. Page ii Migrating IIS 6.0 Web Application to New Version Guidance, Migrating Web Application from IIS6.0 to IIS7.x and above, Version 1.2 Template Prepared by Michael Li (PFE) "Migrating IIS 6.0 Web Application to New Version Guidance.docx" last modified on 17 Jul. 14, Rev 113 Revision and Signoff Sheet Change Record Date Author Version Change reference 7/16/2014 Michael Li 1.0 Initial draft for review/discussion Reviewers Name Version approved Position Date Page iii Migrating IIS 6.0 Web Application to New Version Guidance, Migrating Web Application from IIS6.0 to IIS7.x and above, Version 1.0 Prepared by Michael Li (PFE) "Migrating IIS 6.0 Web Application to New Version Guidance.docx" last modified on 17 Jul. 14, Rev 113 Table of Contents Introduction ................................................................................................................... 1 1 Re-Planning Your Web Server................................................................................ 2 Windows Server 2008 or Windows Server 2012?.................................................................... 3 2 Windows Server Configuration Best Practices ..................................................... 4 2.1 Keep your Processor Scheduling to Background Services ............................................. 4 2.2 Size up your Application log in Windows Event Viewer ................................................... 4 2.3 Keep the proper size of the virtual memory .................................................................... 4 2.4 Reduce protocol binding on the network adapter ............................................................ 5 2.5 Stop unnecessary Windows services ............................................................................. 5 3 IIS Upgrade Considerations .................................................................................... 6 3.1 32bit vs 64bit .................................................................................................................. 6 3.2 Classic Mode vs Integration Mode .................................................................................. 7 3.3 .NET version Considerations .......................................................................................... 8 3.4 User permission Considerations ..................................................................................... 9 3.5 Summary ........................................................................................................................ 9 4 IIS Installation Tips ................................................................................................ 10 5 Migrate Web Content ............................................................................................. 12 6 Tuning Application Pool ........................................................................................ 13 Page iv Migrating IIS 6.0 Web Application to New Version Guidance, Migrating Web Application from IIS6.0 to IIS7.x and above, Version 1.0 Prepared by Michael Li (PFE) "Migrating IIS 6.0 Web Application to New Version Guidance.docx" last modified on 17 Jul. 14, Rev 113 Introduction This document describe how to migrate your web application hosted on IIS 6.0 to IIS 7.0 and above. This document include considerations before upgrade, IIS installation, IIS tuning etc. But SharePoint upgrade is not in scope. Page 1 Migrating IIS 6.0 Web Application to New Version Guidance, Migrating Web Application from IIS6.0 to IIS7.x and above, Version 1.2 Prepared by Michael Li (PFE) last modified on 17 Jul. 14, Rev 113 1 Re-Planning Your Web Server It’s ten years passed, since Windows Server 2003 launched. In these ten years, computer hardware and software has a significant improvement. It means that you may not need web servers as same as ten years ago. For example, you have a 8 nodes load balance web server cluster that running on the Windows Server 2003 ten years ago. For now, maybe 4 nodes web server running on the Windows Server 2012 is enough. To investigate how much nodes you really need. You’d better collect web server performance data from production environment. Analysis real production data is much useful to help you know how much web server you really need. To collect IIS related performance data, you can follow this steps: 1. Download PAL tool from http://pal.codeplex.com . 2. Run the PAL tool, and select “Threshold file” tab. 3. Select “ASP.NET” on threshold file dropdown list. 4. Click “Export to Perform template file”, save the file as “IIS.xml”. 5. Logon Windows Server 2003 machine as Administrator. 6. Start-> Run, log “perfmon.msc” and press Enter. Page 2 Migrating IIS 6.0 Web Application to New Version Guidance, Migrating Web Application from IIS6.0 to IIS7.x and above, Version 1.2 Prepared by Michael Li (PFE) last modified on 17 Jul. 14, Rev 113 7. On the “User Defined” node of left pane, mouse right click and select “New”->”Data Collector Set”. 8. On the creatation wizard, name the collector set and keep default selection, click “Next”. 9. On the template selection page, click “Browse” button and select IIS.xml file that was save on this machine before. Then click “Next”. 10. Keep the selection and click “Finish”. After you get performance data. You can also analysis data by PAL tool. For more information about mining of counters please visit: http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/0a6c9f07-a70c-4c3db93d-5dfef593c744.mspx?mfr=true Windows Server 2008 or Windows Server 2012? To upgrade your Windows OS, you have four options: OS version IIS version Windows Server 2008 IIS 7.0 Windows Server 2008 R2 IIS 7.5 Windows Server 2012 IIS 8.0 Windows Server 2012 R2 IIS 8.5 My recommendation is upgrade to Windows Server 2012 R2. To make this decision, it is based on these reasons: 1. To get 64-bit computing benefits (Windows Server 2008 has 32 bit version). 2. To get the most efficient version of IIS (IIS 8.5). 3. To get a more security, more stable host environment to run your web applications. 4. To avoid frequently upgrade in future years (if Windows 2008 stop supporting, you have to upgrade again). The IIS cannot be upgraded individually. To upgrade IIS means upgrade Windows operating system. Page 3 Migrating IIS 6.0 Web Application to New Version Guidance, Migrating Web Application from IIS6.0 to IIS7.x and above, Version 1.2 Prepared by Michael Li (PFE) last modified on 17 Jul. 14, Rev 113 2 Windows Server Configuration Best Practices When each new Windows server launched, Microsoft would release Performance Tuning Guide document for each OS version. Windows Server 2012 R2 Performance Tuning Guide can be download from: http://go.microsoft.com/fwlink/?LinkId=397832 . You can follow it to tuning your Windows Server 2012 as Web Role. There are also some common tips for tuning your web server: 2.1 Keep your Processor Scheduling to Background Services To check this, please right-click mouse button on “This PC”, and select “Properties”. In “Advanced Settings”->Advanced Tab->Performance Settings->Advanced Tab, you’d better keep the “Processor Scheduling” settings to “Background Services”. This value “Background Services” is default. 2.2 Size up your Application log in Windows Event Viewer The default value of log size is too small to contain enough Windows event especially Windows Application Log. Generally it’s 20MB or 16MB (depends on your OS version). My recommendation is set the size of application log larger than 300MB. To change log size, you have to open Windows Event Viewer (Run->eventvwr). And click “Windows Logs” on the tree of the left pane. Then right-click “Application” item and select “Properties”. On the “Log Properties” window change the value larger than 307200. For more information, please visit: http://support.microsoft.com/kb/957662 2.3 Keep the proper size of the virtual memory The virtual memory can be used in two ways: one is extension of memory, other is the buffer to write kernel dump data. When a blue screen occurred, the blue screen write the whole physical memory data to virtual memory file. If the virtual memory size is not enough, the dump file cannot be write completely. The result is Microsoft support engineer cannot find out the root cause. Page 4 Migrating IIS 6.0 Web Application to New Version Guidance, Migrating Web Application from IIS6.0 to IIS7.x and above, Version 1.2 Prepared by Michael Li (PFE) last modified on 17 Jul. 14, Rev 113 To set the proper virtual memory size, please visit: http://support.microsoft.com/kb/2160852 . Generally speaking, the size depends on how much physical memory usually used. 2.4 Reduce protocol binding on the network adapter To reduce protocol binding is good for network adapter performance. 2.5 Stop unnecessary Windows services Here is some unnecessary services should be stopped: Unnecessary Windows Services Application Experience Lookup Service Background Intelligent Transfer Service Computer Browser DHCP Client Error Reporting Service Help and Support Shell Hardware Detection Print Spooler Telephony Wirless Configuration Note For security considerations, you’d better shutdown above services before your web server going to production environment. And this recommendation is only for web server role. Page 5 Migrating IIS 6.0 Web Application to New Version Guidance, Migrating Web Application from IIS6.0 to IIS7.x and above, Version 1.2 Prepared by Michael Li (PFE) last modified on 17 Jul. 14, Rev 113 3 IIS Upgrade Considerations Before you do your upgrade action you have to understand these and make your decision to your web application. 3.1 32bit vs 64bit On Windows Server 2003, most web application running on 32-bit mode. Because the version of 64-bit Windows Server 2003 is not popular. In 32-bit mode, the 4GB virtual address separates two parts. 0x00000000 – 0x7FFFFFFF is user mode, 0x80000000 – 0xFFFFFFFF is kernel mode. So 32-bit w3wp.exe process memory size usually less than 2GB. If the private bytes of w3wp.exe almost reach 2GB, the web application getting slow down. In 64-bit mode, the virtual memory address almost unlimited (actually it has). To change your web application running on 64-bit mode, You have to confirm that your web application meet these requirements: Page 6 Migrating IIS 6.0 Web Application to New Version Guidance, Migrating Web Application from IIS6.0 to IIS7.x and above, Version 1.2 Prepared by Michael Li (PFE) last modified on 17 Jul. 14, Rev 113 1. Web application is not compiled under x86 mode. If the web application is compiled x86 mode only, the assembly would not load by 64-bit process. 2. Web application is not calling COM object. It is by design that 64-bit process cannot call 32-bit code. Due to the most COM objects are compiled on 32-bit environment, if assemblies running under 64-bit mode the application would not create COM object correctly. The typical scenario are: a) Web application uses MSADO componment to read/write csv file or access db. b) Web application interop Microsoft Office component. 3. Web application is not calling third-party component that only support 32-bits mode. Same as rule 2. If your web application is not meet above rules. Your web application only running 32-bit w3wp.exe process that would be hosted in 64-bit IIS. The good news is on 64-bit IIS service, 32-bit w3wp.exe process has 4GB user mode address than IIS 6.0(WoW64). For more details, please check <<Internet Information Service 7.0 Resource Kit>> Page 632. 3.2 Classic Mode vs Integration Mode In classic mode, IIS manages ASP.NET as a add-on. When a HTTP request reaches to IIS, first step is URL parse. After parse completed, IIS would check the handler mapping list. If request resource is htm or html, IIS handles by itself. If resource is aspx, IIS redirects request to aspnet_isapi.dll. Classic Mode Page 7 Migrating IIS 6.0 Web Application to New Version Guidance, Migrating Web Application from IIS6.0 to IIS7.x and above, Version 1.2 Prepared by Michael Li (PFE) last modified on 17 Jul. 14, Rev 113 The Integrated Mode is the new feature of IIS 7.0 and above. In Integrated Mode IIS will combine ASP.NET into itself. In this mode, ASP.NET application running more efficient. Integrated Mode The big different between these two mode is request context. In classic mode, the request context will go through each process steps. In each process step, code will get request header, verbs and URI correctly. But in integrated mode, request context may not pass to each module due to some ASP.NET modules have been combined into IIS. Now the question is “What kind of ASP.NET web application can running under integrated mode?” There is no exactly answer. If you want to confirm your web application can running under integrated mode, you’d better do a black-box testing. My recommendations is: a) if your web application has some legacy pages like asp, you’d better set to classic mode. b) If your web application is base on .NET 1.1 please set to classic mode. 3.3 .NET version Considerations .NET has been released three major version: 1.1, 2.0, 4.0. The other version 3.0, 3.5 are base on 2.0. core library doesn’t change. Compare with .NET 2.0 and .NET 4.0, the new version has a significant improvement. .NET 4.0 is more flexible and more efficient. If your web application still has the newest version source code. You can migrate your web application to new .NET version. Page 8 Migrating IIS 6.0 Web Application to New Version Guidance, Migrating Web Application from IIS6.0 to IIS7.x and above, Version 1.2 Prepared by Michael Li (PFE) last modified on 17 Jul. 14, Rev 113 3.4 User permission Considerations There is a built-in account named “Network Service” that is used to run work process. This account can do some limited actions on local web service and related resources. For example, this account can create new file in its own virtual directory and sub directories but cannot create a new file in its parent directory. To known the precise permissions you can visit: http://msdn.microsoft.com/en-us/library/ff647402.aspx . With IIS 7.0 launched, Microsoft offered a new kind of worker process account. It’s named ApplicationPoolIdentity. This kind of account can let your permissions more flexible and security. Before you upgrade IIS, you’d better consider this kind of account can apply your worker process. To know more details, please visit: http://www.iis.net/learn/manage/configuring-security/application-pool-identities . 3.5 Summary Base on above considerations, you have to collect information from your software vendors or partners. For questionnaire, please check these: Does vendor still have the newest source code to match your web application? Does your web application call a COM object? Does your web application call a third-party component that cannot running in 64-bit mode? Does your web application have standalone installer? What’s your web application permissions? What’s the .NET version your web application required? Does the web application need other application installed on web server? Like Windows Service, Task Scheduler or other tools. Does the web application need other configuration settings? Like registry key, Machine.config, aspnet.config etc. Page 9 Migrating IIS 6.0 Web Application to New Version Guidance, Migrating Web Application from IIS6.0 to IIS7.x and above, Version 1.2 Prepared by Michael Li (PFE) last modified on 17 Jul. 14, Rev 113 4 IIS Installation Tips Another big different between IIS 6.0 and IIS 7.0 is new IIS features has componentized. When you install IIS, you will find a lot of options like this: Here is a list of component that you have to install: Component Name Comments Web Management Tools IIS Management Console IIS Management Scripts and Tools IIS Management Service Application Development Features .NET Extensibility 3.5 or .NET Extensibility 4.5 Application Initialzation ASP.NET 3.5 ASP depends on web application requirement. .NET 3.5 or .NET 4.5 please chose one version. WebSocket Protocol is only used for HTML5, for old style dynamic conent page is useless. or ASP.NET 4.5 Server-Side Includes Common HTTP Features Default Document HTTP redirection and Web DAV publishing depends on web application requirement. HTTP Errors Static Content Health and Diagnostics HTTP Logging Logging Tools Request Monitor Page 10 Migrating IIS 6.0 Web Application to New Version Guidance, Migrating Web Application from IIS6.0 to IIS7.x and above, Version 1.2 Prepared by Michael Li (PFE) last modified on 17 Jul. 14, Rev 113 Tracing Performance Features Static Content Compression Security The Dynamic Content Compression will use more CPU utilization time. If your end users access site by dial-up or ADSL, please install Dynamic Content Compression. Otherwise please disable this feature. It totally depends on real requirement. Note For security considerations, You’d better only install the components you really need. FTP services is not recommend. Page 11 Migrating IIS 6.0 Web Application to New Version Guidance, Migrating Web Application from IIS6.0 to IIS7.x and above, Version 1.2 Prepared by Michael Li (PFE) last modified on 17 Jul. 14, Rev 113 5 Migrating Website Content Microsoft has created a tool called Web Deploy. This tool can package web content into a zip file. And on the target server, you can also extract zip file by this tool. I don’t want to spend a lot of words to discuss it. For more details, please visit: http://www.iis.net/learn/publish/using-web-deploy/migrate-a-web-site-from-iis-60-to-iis-7-or-above Note The Web Deploy tool reads IIS configuration file and only package web content in virtual directory. For complicate deploy action like combine registry key, register COM object this tool won’t help you more. Unfortunately, Web Deploy tool is base on .NET 2.0. To migrate .NET 1.1 web application from Windows Server 2003, you have to install .NET 2.0 Redist on Windows Server 2003 first. Page 12 Migrating IIS 6.0 Web Application to New Version Guidance, Migrating Web Application from IIS6.0 to IIS7.x and above, Version 1.2 Prepared by Michael Li (PFE) last modified on 17 Jul. 14, Rev 113 6 Tuning Application Pool By default, application pool settings are not optimized. For the general situation: A web server only running one website that must offer 7x24 service, I will give you a best settings as below: Application Pool Settings The Best Value Start Mode AlwaysRunning Idle Time-out (Minutes) 0 Rapid-Faild Protection Enabled False Disable Overlapped Recycling False Regluar Time Interval 0 Specific Time Specifiy a not busy time, like 2:00 AM. MSIT team has an classic article to discuss application pool tuning: Managing, Tuning, and Configuring Application Pools in IIS 7.0 To get the best performance on your worker process, you also have configure processModel element in configuration file. To set MaxIOThreads = 100 and MaxWorkerThreads = 100. For details please visit: http://msdn.microsoft.com/en-us/library/vstudio/7w2sway1(v=vs.100).aspx For tuning ASP.NET thread usage, you also need to check this: http://blogs.msdn.com/b/tmarq/archive/2007/07/21/asp-net-thread-usage-on-iis-7-0-and-6-0.aspx Page 13 Migrating IIS 6.0 Web Application to New Version Guidance, Migrating Web Application from IIS6.0 to IIS7.x and above, Version 1.2 Prepared by Michael Li (PFE) last modified on 17 Jul. 14, Rev 113 References 1. Upgrading ASP.NET 1.1 to IIS 7.0 on Windows Vista and Windows Server 2008 2. Using Web Deploy 3. Web Deploy Tool on TechNet 4. Upgrading To IIS 7 on TechNet 5. Professional IIS 8 Page 14 Migrating IIS 6.0 Web Application to New Version Guidance, Migrating Web Application from IIS6.0 to IIS7.x and above, Version 1.2 Prepared by Michael Li (PFE) last modified on 17 Jul. 14, Rev 113