I recently worked on an application that required we mirror content and configuration across multiple web servers running IIS 7.5 on Windows 2008r2. Because the server configuration in IIS for this application is relatively complicated, doing it over and over would not only be tedious but it would probably introduce some human error. While the possibility of human error is mitigated by the application’s detailed documentation, I looked for a more automated approach to the process.
Using IIS 7’s shared configuration management, it’s possible to replicate the content and configuration folders between web servers. As I worked through the steps of mirroring the content and server configuration for our application, I took notes on the process to create this guide for you to use the next time you approach a similar project.
You will need a domain account – or local account on each web server if your web servers aren’t joined to an Active Directory domain – which will be used to access the shared configuration. The account only accesses this configuration and a file share to store the configuration. Your web applications continue to run under whatever application pool identity you’ve set.
Assuming you’ve configured your IIS-based web server, we can start by exporting the configuration:
- On the first web server that will host the shared configuration, create a directory and share it with full share and ntfs permissions to the service account you create. All other permissions should be removed.
- In IIS manager, click on the server node in the left pane, then open “Shared Configuration” in the right pane.
- Select the”Export Configuration” option on the right, store the export in the directory you created in step 1.
- Create an encryption key. This key should be recorded, as it is needed for all nodes accessing the shared configuration.
- After the configuration is exported, tick the ‘Enable shared configuration’ box, and enter the UNC path to the configuration and the username, domainserviceaccount and password for that account.
- Press apply, and you will be prompted for the encryption key created in step 2.
- Restart the server or run an
iisreset
to apply configuration. Check to ensure that IIS is still functioning and the IIS manager can be accessed.
After completing those steps, your web server will be running from the shared configuration, so the next step is to replicate the web content and configure all other web servers to work from the same configuration.
There are several ways of replicating the physical content, DFSR is one option, however I chose not to use it. The content on this application’s web servers is static, so frequent updates to the other nodes is unnecessary. Instead, I used robocopy – a built-in feature since Vista / Server 2008 – to mirror the content from the configured server to all others. This was executed on the web server receiving the content:
robocopy \configuredwebserverc$inetpubwwwroot c:inetpubwwwroot /MIR
Once the file content is in place, two quick steps are required to configure IIS to use the shared configuration:
- In IIS manager, click on the server node in the left pane, then open “Shared Configuration” in the right pane.
- Tick the ‘Enable shared configuration’ box. Enter the UNC path to the configuration as specified on the first web server.
- Enter the username, domainserviceaccount and password for that account. Press apply and enter the encryption key.
- Restart the IIS server to apply configuration, and check to ensure that IIS is still functioning and the IIS manager can be accessed.
You’re done. You’ve replicated all application pools and IIS configurations. If you have ODBC data sources – things external to IIS which your web applications are using – you will need to find a way to replicate these settings as well.
If the shared configuration is unavailable for any reason, IIS may act up. In Server 2008 (not R2), if the configuration disappears, IIS will essentially stop. In R2, the server will detect this, continue working and reconnect when the configuration source comes back online.
To safeguard against connectivity issues, enable offline files by following these steps:
- On the web server, in “Control Panel,” open “Offline Files.”
- In the Offline Files dialog box, click Enable Offline Files. Do not reboot the machine yet.
- Ensure that the cache is set to read only by running the following command:
REG ADD "HKLM\System\CurrentControlSet\Services\CSC\Parameters" /v ReadOnlyCache /t REG_DWORD /d 1 /f
- Reboot the Web server.
- Browse to the shared configuration folder on the web server. Right click and select “Always Available Offline”.
- Go back to the “Offline Files” in “Control Panel” and select the “Schedule” option.
The sync center option is available on Windows 2008 server only when Desktop experience is enabled. KB 951043: You cannot start Sync Center from Windows Explorer on a Windows Server 2008-based computer.
- Schedule offline file sync every day or per your requirements. Even without setting up any scheduler, the moment I change anything in applicationhost.config file, it is reflected on the web server.
Hopefully this method should save you from a few headaches and give you another option when setting up multiple IIS 7 web servers. Being able to use the same configuration minimize deployment time and makes administration a breeze.
Let me know if you have any questions or would like any additional details about the process.
-Marlin
Related Posts:
- Lilah Brown's Planets, Part II (or, Season II preview) [Last Updated On: November 8th, 2009] [Originally Added On: November 8th, 2009]
- Snow White needs a bailout [Last Updated On: November 8th, 2009] [Originally Added On: November 8th, 2009]
- To the moon [Last Updated On: November 8th, 2009] [Originally Added On: November 8th, 2009]
- S/1 90482 (2005) needs your help [Last Updated On: November 8th, 2009] [Originally Added On: November 8th, 2009]
- We'll always have Regulus [Last Updated On: November 8th, 2009] [Originally Added On: November 8th, 2009]
- Orcus Porcus [Last Updated On: November 8th, 2009] [Originally Added On: November 8th, 2009]
- Kant's Crowded Universe [Last Updated On: November 8th, 2009] [Originally Added On: November 8th, 2009]
- Look up! [Last Updated On: November 8th, 2009] [Originally Added On: November 8th, 2009]
- Baby Pictures [Last Updated On: November 8th, 2009] [Originally Added On: November 8th, 2009]
- Encore: Yelping at Saints [Last Updated On: November 8th, 2009] [Originally Added On: November 8th, 2009]
- Godspeed [Last Updated On: November 8th, 2009] [Originally Added On: November 8th, 2009]
- Heavens above! [Last Updated On: November 8th, 2009] [Originally Added On: November 8th, 2009]
- Homeward bound [Last Updated On: November 8th, 2009] [Originally Added On: November 8th, 2009]
- Sony Pictures and the end of the world [Last Updated On: November 8th, 2009] [Originally Added On: November 8th, 2009]
- Thank you from the future [Last Updated On: November 8th, 2009] [Originally Added On: November 8th, 2009]
- Lunar dreams [Last Updated On: November 8th, 2009] [Originally Added On: November 8th, 2009]
- The first of the Pluto books! [Last Updated On: November 8th, 2009] [Originally Added On: November 8th, 2009]
- Don't try to blame it on Rio [Last Updated On: November 8th, 2009] [Originally Added On: November 8th, 2009]
- Rio roundup [Last Updated On: November 8th, 2009] [Originally Added On: November 8th, 2009]
- The long road to a Titan storm [Last Updated On: November 8th, 2009] [Originally Added On: November 8th, 2009]
- Planetary Placemats [Last Updated On: November 8th, 2009] [Originally Added On: November 8th, 2009]
- Fog! Titan! Titan Fog! (and a peer review experiment) [Last Updated On: November 8th, 2009] [Originally Added On: November 8th, 2009]
- Millard Canyon Memories [Last Updated On: November 8th, 2009] [Originally Added On: November 8th, 2009]
- The problem with science [Last Updated On: November 8th, 2009] [Originally Added On: November 8th, 2009]
- P.S. on the problem with science [Last Updated On: November 8th, 2009] [Originally Added On: November 8th, 2009]
- How Big is 10 TB? [Last Updated On: November 8th, 2009] [Originally Added On: November 8th, 2009]
- Showing You Your Servers [Last Updated On: November 8th, 2009] [Originally Added On: November 8th, 2009]
- Pick Your Partnership: Referral Partners, Resellers and Affiliates [Last Updated On: November 8th, 2009] [Originally Added On: November 8th, 2009]
- Server Form Factors: Towers v. Rack-Mounts [Last Updated On: November 8th, 2009] [Originally Added On: November 8th, 2009]
- Lights-Out in the Data Centers [Last Updated On: November 8th, 2009] [Originally Added On: November 8th, 2009]
- Disruptive Technologies: Virtualization and The Cloud [Last Updated On: November 8th, 2009] [Originally Added On: November 8th, 2009]
- Know Thy Backups – Part I [Last Updated On: November 8th, 2009] [Originally Added On: November 8th, 2009]
- Know Thy Backups – Part II [Last Updated On: November 8th, 2009] [Originally Added On: November 8th, 2009]
- Boo Bash 2009 – Desktop Costume Included! [Last Updated On: November 8th, 2009] [Originally Added On: November 8th, 2009]
- Why No One Will Talk About “Cloud Computing” in 10 Years [Last Updated On: November 8th, 2009] [Originally Added On: November 8th, 2009]
- The end of the fall [Last Updated On: December 13th, 2009] [Originally Added On: December 13th, 2009]
- We Love ‘Server Huggers’ [Last Updated On: December 13th, 2009] [Originally Added On: December 13th, 2009]
- All About the Cloud: An Interview with Dell’s Cloud Evangelist [Last Updated On: December 13th, 2009] [Originally Added On: December 13th, 2009]
- Happy Solstice [Last Updated On: December 21st, 2009] [Originally Added On: December 21st, 2009]
- A ghost of Christmas past [Last Updated On: December 31st, 2009] [Originally Added On: December 31st, 2009]
- Learning from a Blender [Last Updated On: January 5th, 2010] [Originally Added On: January 5th, 2010]
- Changing my world [Last Updated On: January 6th, 2010] [Originally Added On: January 6th, 2010]
- A Server. From Scratch. [Last Updated On: January 7th, 2010] [Originally Added On: January 7th, 2010]
- The Planet Sand Castle: Upgrade Your Sandbox [Last Updated On: January 12th, 2010] [Originally Added On: January 12th, 2010]
- Hosting for Haiti [Last Updated On: January 20th, 2010] [Originally Added On: January 20th, 2010]
- Redefining Value [Last Updated On: January 26th, 2010] [Originally Added On: January 26th, 2010]
- My Experience as a Newbie at The Planet [Last Updated On: January 28th, 2010] [Originally Added On: January 28th, 2010]
- Confessions of Another New Planeteer [Last Updated On: February 1st, 2010] [Originally Added On: February 1st, 2010]
- How I Learned to Stop Worrying and Love Permissions [Last Updated On: February 11th, 2010] [Originally Added On: February 11th, 2010]
- Where at The Planet is Rachel? [Last Updated On: February 15th, 2010] [Originally Added On: February 15th, 2010]
- The Planet Storage Cloud: FYI [Last Updated On: February 19th, 2010] [Originally Added On: February 19th, 2010]
- Meet us in March [Last Updated On: February 25th, 2010] [Originally Added On: February 25th, 2010]
- The Planet in “The Channel” [Last Updated On: March 2nd, 2010] [Originally Added On: March 2nd, 2010]
- The Planet Server Challenge [Last Updated On: March 13th, 2010] [Originally Added On: March 13th, 2010]
- The Definitive Guide to Finding The Planet at SXSW [Last Updated On: March 13th, 2010] [Originally Added On: March 13th, 2010]
- The SXSW Iron Geek Champion! [Last Updated On: March 15th, 2010] [Originally Added On: March 15th, 2010]
- Drinking from the Fire Hose [Last Updated On: March 16th, 2010] [Originally Added On: March 16th, 2010]
- The Fastest Hands at SXSW [Last Updated On: March 17th, 2010] [Originally Added On: March 17th, 2010]
- System.out.println(“Hello World!”); [Last Updated On: March 22nd, 2010] [Originally Added On: March 22nd, 2010]
- Westmere – Get it Here [Last Updated On: March 23rd, 2010] [Originally Added On: March 23rd, 2010]
- Orbit on Your iPhone: A Sign of Things to Come [Last Updated On: March 24th, 2010] [Originally Added On: March 24th, 2010]
- #ShowMeMyServer 2.0 [Last Updated On: March 25th, 2010] [Originally Added On: March 25th, 2010]
- Get to Know Your Visitors [Last Updated On: March 30th, 2010] [Originally Added On: March 30th, 2010]
- The Next Big Thing in Hosting: The Hostatulator [Last Updated On: April 1st, 2010] [Originally Added On: April 1st, 2010]
- Storage Cloud and the City [Last Updated On: April 4th, 2010] [Originally Added On: April 4th, 2010]
- American Heart – Why I Walk [Last Updated On: April 7th, 2010] [Originally Added On: April 7th, 2010]
- The Cake Shouldn’t Be a Lie [Last Updated On: April 8th, 2010] [Originally Added On: April 8th, 2010]
- April Showers Bring May Flowers [Last Updated On: April 9th, 2010] [Originally Added On: April 9th, 2010]
- First at The Planet: Nehalem EX 4-Socket Servers [Last Updated On: April 15th, 2010] [Originally Added On: April 15th, 2010]
- Intel Guest Blog: Xeon 5600 [Last Updated On: April 16th, 2010] [Originally Added On: April 16th, 2010]
- Inside the Office: A Birthday Surprise [Last Updated On: April 18th, 2010] [Originally Added On: April 18th, 2010]
- The Planet @ Cloud Expo East [Last Updated On: April 19th, 2010] [Originally Added On: April 19th, 2010]
- The Planet @ ad:tech SF [Last Updated On: April 22nd, 2010] [Originally Added On: April 22nd, 2010]
- ad:tech Server Challenge [Last Updated On: April 22nd, 2010] [Originally Added On: April 22nd, 2010]
- ad:tech Panel: Developing Communities Online [Last Updated On: April 23rd, 2010] [Originally Added On: April 23rd, 2010]
- The Planet @ Interop Las Vegas [Last Updated On: April 27th, 2010] [Originally Added On: April 27th, 2010]
- Overflowing With Value: 10TB is Back! [Last Updated On: April 28th, 2010] [Originally Added On: April 28th, 2010]
- The Cloud is NOT the Revolution [Last Updated On: April 29th, 2010] [Originally Added On: April 29th, 2010]
- The Importance of Orbit 2.0 [Last Updated On: May 5th, 2010] [Originally Added On: May 5th, 2010]
- The Planet @ Web 2.0 Expo [Last Updated On: May 6th, 2010] [Originally Added On: May 6th, 2010]