Scott Forsyth's Blog

Postings on IIS, ASP.NET, SQL Server, Webfarms and general system admin.

.

  • Scott Forsyth

Hosting Needs

Training and Dev Labs

February 2011 - Posts

URL Rewrite, ServerVariables, URL Parts, HTTP to HTTPS Redirect. Week 9

Last week I gave an intro to URL Rewrite; covering the basics and giving a real world example.  This week I dive in deeper and cover ServerVariables, the parts that make up the URL and another real world example of redirecting HTTP to HTTPS.

This is week 9 of a 52 week series on various web administration related tasks.  Past and future videos can be found here.

For reference, in the video I mentioned the following two blog posts:

An Intro to IIS URL Rewrite–plus redirecting URLs to www-Web Pro Week 8 of 52

Today’s video post is an intro to URL Rewrite and the start of a few lessons on this powerful tool.  Additionally I cover how to rewrite URLs to add the www to the domain name for the sake of search engine optimization (SEO).

This is week 8 of a 52 week series on various web administration related tasks.  Past and future videos can be found here.

I have already written a blog post on this, so for those that prefer to read rather than watch, you can find it here.

Issues getting Hyper-V Dynamic Memory to work in Win 2008 R2 SP1

On Wednesday Windows Server 2008 R2 and Windows 7 Service Pack 1 was made available for Technet and MSDN subscribers.  It will be available as a public download Feb 22nd.

The dynamic memory feature is a huge benefit to our business model at Vaasnet so I was eager to download and try it out.  During the beta and RC cycle, dynamic memory only worked for certain operating systems and editions.  Web and Standard editions weren’t supported, but were promised for final release.

First off, the download is large and the install is very slow.  In fact it takes longer to upgrade the Service Pack than it does for the initial installation.  Windows 7 SP1 took about 1/2 hour on my new desktop computer, and Windows Server 2008 R2 SP1 took about 1/2 hour on one server and took well over an hour on two other servers.  In fact, a warning message during the install says that it can take an hour or more and require one or more reboots.

The install was very clean and you have the option to have the installer reboot automatically.  This means that you can accept the license and a couple next/next buttons to kick it off and walk away and it will complete it to 100% without any further interaction.  That makes up for the long install time.

Anyway, back to my real issue. 

After upgrading the host I wanted to test dynamic memory on some Windows Server 2008 R2 Standard edition VMs.  During the beta cycle you simply needed to upgrade the Integration Services components for editions like Enterprise edition, so I assumed that was all that was needed here.

As a side, there are already many great articles and walkthroughs available on how to do this.  Here are some good links for further information on this topic:

Try as I might, I couldn’t get the dynamic memory to work.  Memory Demand and Memory Status fields didn’t populate and the OS didn’t change the memory level.  The new columns appeared on the server after upgrading the Host server, but nothing on the guests.

image

I read and re-read all posts available to date and I ensured that I had the key elements completed successfully:

  • upgraded Integration Services on the guest
  • powered off the VM and set dynamic memory range from 512 to 4096

No luck.  So, I figured there must be something in the release notes that would give me a clue.  Finally, and it wasn’t easy to find, I found my answer. 

It turns out that simply upgrading the Integration Services components isn’t enough for certain editions of the OS!  You MUST upgrade to Service Pack 1 on the guest for Windows Server  2008 R2 Web and Standard editions.  And you may also need to perform one extra reboot after the install.

After that it worked!

image

I’m sure this information will be easier to find in the coming days and weeks, but for those that find this blog post first, here’s the key link: http://technet.microsoft.com/en-us/library/ff817651(WS.10).aspx

And, here’s my version of the chart summarizing the requirements for the different editions.

Guest OS Edition
(32-bit and 64-bit)
Enlightenment Requirements
Windows Vista
(with SP1)
Ultimate
Enterprise
Only
- Upgrade Integration Services
Windows 7 Ultimate
Enterprise
Either
- Install SP1 in the guest OS
- Upgrade Integration Services
Windows 2003 Server
(with SP2)
Standard
Web
Enterprise
Datacenter
Only
- Upgrade Integration Services
Windows 2003 Server R2
(with SP2)
Standard
Web
Enterprise
Datacenter
Only
- Upgrade Integration Services
Windows Server 2008
(with SP2)
Web
Standard
Only
- Upgrade Integration Services
- Plus install hotfix in article 2230887
Windows Server 2008
(with SP2)
Enterprise
Datacenter
Only
- Upgrade Integration Services
Windows Server 2008 R2 Web
Standard
Only option (here’s the surprise)
- Install SP1 in the guest OS
Windows Server 2008 R2 Enterprise
Datacenter
Either
- Install SP1 in the guest OS
- Upgrade Integration Services

The key takeaway is that Windows Server 2008 R2 Web and Standard Editions require Service Pack 1.  Unlike all other OSes and editions, they will not work simply by upgrading the Integration Services.

Furthermore, after installing SP1 on the guest, it still didn’t work for me.  I had to do one further reboot after the install completed!  It seems that the SP1 upgrade installs everything, but one more reboot was required to activate the new functionality.

When it’s working, it works great!  Hopefully this helps someone else that made the same assumptions that I did.

Setting Host Headers for SSL Sites in IIS–Week 7 of 52

At first glance, the Host Header field is grayed out when applying host headers to SSL (HTTPS) sites in IIS 7.

This week I cover a trick plus a full featured way to set these host headers in IIS 7.0/7.5 and IIS 6.  If you haven’t watched last week’s video, I recommend watching it first since it covers the reasons and issues for host headers on SSL sites.

This is week 7 of a 52 week series on various web administration related tasks.  Past and future videos can be found here.

Host Headers in SSL Sites

Here are some links mentioned in the video:

http://www.sslshopper.com/article-ssl-host-headers-in-iis-7.html
http://www.sslshopper.com/article-how-to-configure-ssl-host-headers-in-iis-6.html

Unified Communications Certificate (aka Subject Alternative Name [SAN]) options: http://www.bing.com/search?q=unified+communications+certifcate

The SSL Bindings Issue–Web Pro Week 6 of 52

We have a chicken before the egg issue with HTTPS bindings.  This video—week 6 of a 52 week series for the web administrator—covers why HTTPS bindings don’t support host headers the same as HTTP bindings do.  In this video I show the issue and use Wireshark to see it in action.

If you haven’t seen the other weeks, you can find past and future videos on the Web Pro Series landing page.

The SSL Bindings Issue
Slow boot from massive registry on a Hyper-V server: Fix

At OrcsWeb we started seeing some of our Hyper-V host servers taking longer and longer to reboot for patching or other maintenance.  It got to the point that one server was taking longer than an hour to start up after a reboot.

Obviously this wouldn’t do! 

The Cause

From research we found that there is a known bug with Volume Shadow Copy Service (VSS) based backups—in our case from DPM—causing the registry to grow.  By the time we resolved the most problematic server the registry had grown to 1/2 GB.  No wonder it took so long to boot.

There are good docs from Microsoft and others, but from my working through this I found that there is some information lacking, so this blog post is meant to pull together some of the key information that helped me with Windows Server 2008 RTM and 2008 R2 servers.  Notice that I said Windows Server 2008 RTM too.  Some articles out there suggest that it only affects R2.  That’s not the case.

The issue resulted in Windows hanging or staying on the logon Welcome screen for a long time before allowing the user to logon. 

Ben Armstrong summarizes the issue well:

Whenever we backup a virtual machine using VSS, we momentarily connect the backup copy of the virtual machines virtual hard disks to the parent partition in order to clean them up after backup.  Unfortunately with Windows Server 2008 R2 a new plug-and-play entry would get created in the Windows registry each time that we did this.  Over time this would cause the registry to get larger and larger, which would in turn slow down the Windows boot process.

Since others, including Microsoft, have already written about it, I’ll first reference them.  It’s worth reviewing them since I won’t repeat everything covered:

  • MS KB Article 982210 on the issue
  • Gary’s Gambit’s 3 part series on this.  Great read.  It’s progressive, in that the first two posts are discovery of the issue with some conclusions based on the limited information available at the time.  Part III pulls it all together.
  • A recent post from Gary Herbstman with links to 32-bit and 64-bit versions of DevNodeClean!  More on this below.

The Fix

To fix it, there are 2 steps.  The hotfix in Microsoft’s KB Article 982210 ONLY prevents the issue from continuing.  It does not actually clean the existing orphan devices.  Additionally, the hotfix is only for Windows Server 2008 R2. 

Furthermore, I’m not 100% confident that it addresses every orphan device.  On patched Windows Server 2008 R2 servers there are a “small number” of phantom devices that build over time.  Small number = maybe 50 devices rather than 28K.  It’s definitely not as bad as the original issue, but you may want to run devnodeclean (more on this below) from time to time even on an R2 server.

So, my recommendation is two-fold:

  • Do apply Microsoft’s hotfix on Windows Server 2008 R2 (KB Article 982210)
  • Run devnodeclean on all servers with Hyper-V installed.
    • For Windows Server 2008 RTM, schedule it to run daily with Windows Task Scheduler. 

Once you perform these two steps you should be set, and you’ll have quick reboots again.

Devnodeclean

Here’s the issue … where’s devnodeclean???  Sample C++ source is available but Microsoft hasn’t made a compiled version available publicly yet.  Apparently you can call Microsoft product support and they will provide it.  I discovered that later so I haven’t tried calling Microsoft support.  It’s a known bug so you should be able to get support for free, or get a refund if you have to use a support ticket to first talk to them.

Since I originally worked on it some copies have sprung up across the internet.  Be careful because I’m sure there are some malicious versions out there.  I haven’t tested but this one from Gary at Byte Solutions looks promising.  Edit: And since my original post Gary commented and made one adjustment to his version so that it’s completely xcopyable and a single EXE.  I recommended considering his version.

As a side, a free tool called device remover is mentioned in the comments of this post as a solution although I didn’t have success with it.  You’ll likely have better success with devnodeclean.

You have about three choices.  You can use the version from Gary.  In fact, that’s likely the easiest solution.  You can call Microsoft product support.  Or you can compile it yourself. 

Since I already fought through this a couple months ago, I’ll post the steps necessary to compile the version listed here in case you want to go that direction: http://support.microsoft.com/kb/934234

First start with KB article 934234.  However, there are 3 extra steps that are required for Visual Studio 2010 that aren’t listed in that article.

  • First, if you’re targeting a 64-bit machine, you must compile it as a 64-bit DLL otherwise it will fail with a useless error message.  You can use Visual Studio 2010 with C++ installed.  Be sure to be explicit that it’s a x64 release.  If you’re targeting a 32-bit machine, you must create another DLL for that environment.
  • Second, when compiling you’ll get an error that you “Cannot convert from 'const char [..]' to 'LPCTSTR'”.  Using the suggestion from this post I changed the Character set to “Use Multi-Byte Character Set” in the project properties.
    image
  • Third is to make sure that the dependencies are included with the project.  If you perform this step then your version is completely xcopyable between servers as a single simple .exe file that doesn’t need an installer.  This post pointed me in the right direction.  From the project properties change to Release mode and then go to Configuration Properties –> C/C++ –> Code Generation and change RunTime Library from Multi-threaded DLL (/MD) to Multi-threaded (/MT)
    SNAGHTML1c103d41
  • Once you compile it you’ll have yourself a clean executable.

To run devnodeclean (aka Cleanup) I prefer to run it from the command line.  If you call it without any parameters it will find and remove all of the phantom devices.  It’s very fast and you’ll immediately see feedback as it works.

Disclaimer: Microsoft hasn’t released this yet, probably for some reason.  They must not feel that it has gone though adequate testing.  So only run this if you need to and understand that there is some risk.  That said, I’ve run this on about a dozen 2008 RTM and 2008 R2 servers for 2 months now and it has worked beautifully.

Summary

Let me summarize for those that don’t want to read the whole post or follow the links.

During backups VSS will create temporary registry entries for devices drivers that aren’t properly deleted afterward.  If you back up your Hyper-V system with something like DPM, set to have hourly snapshots, and with lots of virtual machines, this can cause tens of thousands of stale device references in the registry.

There is a fix available for Windows Server 2008 R2, but it doesn’t clean up the phantom devices already created.  So, you must:

  • Apply the hotfix found here: KB Article 982210 (Windows Server 2008 R2 only)
  • Then run devnodeclean to clean up existing phantom devices.  Additionally, on Windows Server 2008 RTM, schedule devnodeclean with Windows Task Scheduler to run daily.  You can obtain devnodeclean from one of the following 3 methods:
    • Call Microsoft product support services and reference KB Article 982210.
    • Use the version made available from Gary Herbstman at Byte Solutions.
    • If for some reason those don’t work out, you can follow the instructions in my post above on how to compile your own version.

I hope this helps.  Happy fast rebooting!

More Posts