I came back from a nice long vacation only to find that my local development VM for Microsoft Office SharePoint Server (MOSS) 2007 was corrupted. By "corrupted", I mean to say there were lots of errors in the event log about the SharePoint_Config database being "out of whack." Okay, I'm paraphrasing this a little, but you get the point.

The corruption may very well have been caused by the fact that back in December I swapped out my last remaining Virtual Server 2005 box with a new Hyper-V box, and perhaps I didn't quite keep the 5 VHDs for this VM in sync as I shuffled them around from external/internal disks and from server to server. [The Hyper-V server is a new Windows Server 2008 build on a box that was previously serving as the Windows Vista Media Center in my family room. So I had to swap some drives around, tweak the BIOS in order to enable Hyper-V, and lots of other not-so-fun stuff just to get back in business.]

Regardless of how the corruption occurred, I decided that, rather than attempting to troubleshoot and resolve the corruption, I'd simply build up a new VM and start fresh. [In the world of software development, this is a very good thing to do from time to time.]

Starting with a fresh Windows Server 2008 (x86) VM, I proceeded to install SQL Server 2008 and MOSS 2007. Everything was going smooth until I got to the Specify Configuration Database Settings step in the SharePoint Products and Technologies Configuration Wizard (psconfigui.exe). As soon as I entered the database server (i.e. the name of the VM itself, since SQL is running locally), followed by the username/password for the database access account, and then clicked Next, the Config Wizard went off into La-La Land (in other words, it hung).

Having done dozens of SharePoint installs previously, this baffled me. I'd never encountered a problem getting to the next step in the wizard, in which you specify the port number and security settings for the Central Administration Web Application. In fact, the next step in the wizard is usually displayed in a second or two.

After waiting over 10 minutes for some miracle that never came, I killed the Config Wizard, and then restarted it.

You know what's coming...don't you?!

It hung again.

Hmmm...maybe my VM was having trouble communicating with the domain controller to verify the credentials that I specified for the database access account. To rule this out, I started up a command prompt and used runas.exe to confirm the username/password against the domain controller. Sure enough that worked just fine.

I then turned my attention to the log files generated by the Config Wizard.

I discovered the following (the interesting stuff starts about halfway down):

01/15/2009 13:55:07  1  INF                  Entering function CreateCentralAdministrationSiteForm.CreateCentralAdministrationSiteFormInitializeBeforeShow
01/15/2009 13:55:07  1  INF                    Found a task by the name of adminvs in the task collection
01/15/2009 13:55:07  1  INF                    Entering function TaskCommon.GenerateRandomUnUsedPort
01/15/2009 13:55:07  1  INF                      Entering function TaskCommon.EnsureIIs
01/15/2009 13:55:07  1  INF                        Entering function PreRequisiteChecks.IsIisInstalled
01/15/2009 13:55:07  1  INF                          Entering function PreRequisiteChecks.IsRightVersionOfIis
01/15/2009 13:55:07  1  INF                            Version of IIS is 7
01/15/2009 13:55:07  1  INF                          Leaving function PreRequisiteChecks.IsRightVersionOfIis
01/15/2009 13:55:07  1  INF                        Leaving function PreRequisiteChecks.IsIisInstalled
01/15/2009 13:55:07  1  INF                        Entering function PreRequisiteChecks.IsRightVersionOfIis
01/15/2009 13:55:07  1  INF                          Version of IIS is 7
01/15/2009 13:55:07  1  INF                        Leaving function PreRequisiteChecks.IsRightVersionOfIis
01/15/2009 13:55:07  1  INF                        Entering function ServiceHelper.Start
01/15/2009 13:55:07  1  INF                          Trying to start service W3SVC and waiting 120 sec to do so
01/15/2009 13:55:07  1  INF                          service W3SVC is Running, nothing to do 
01/15/2009 13:55:07  1  INF                          starting service W3SVC (it may already be started)
01/15/2009 13:55:07  1  INF                        Leaving function ServiceHelper.Start
01/15/2009 13:55:07  1  INF                      Leaving function TaskCommon.EnsureIIs
01/15/2009 13:55:07  1  INF                      Trying to see if port 9183 is free on machine DMX-FOOBAR2.  Min port we will try is 1024, Max port we will try is 49151
01/15/2009 13:55:32  1  INF                      A SocketException was thrown with SocketError TimedOut
01/15/2009 13:55:32  1  INF                      Entering function Common.BuildExceptionInformation
01/15/2009 13:55:32  1  INF                        Entering function Common.BuildExceptionMessage
01/15/2009 13:55:32  1  INF                          Entering function StringResourceManager.GetResourceString
01/15/2009 13:55:32  1  INF                            Resource id to be retrieved is ExceptionInfo for language English (United States)
01/15/2009 13:55:32  1  INF                            Resource retrieved id ExceptionInfo is An exception of type {0} was thrown.  Additional exception information: {1}
01/15/2009 13:55:32  1  INF                          Leaving function StringResourceManager.GetResourceString
01/15/2009 13:55:32  1  INF                        Leaving function Common.BuildExceptionMessage
01/15/2009 13:55:32  1  INF                      Leaving function Common.BuildExceptionInformation
01/15/2009 13:55:32  1  ERR                      An exception of type System.Net.Sockets.SocketException was thrown.  Additional exception information: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 192.168.0.11:9183
System.Net.Sockets.SocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 192.168.0.11:9183
   at System.Net.Sockets.TcpClient..ctor(String hostname, Int32 port)
   at Microsoft.SharePoint.PostSetupConfiguration.TaskCommon.GenerateRandomUnUsedPort(Int32 max, Int32 min, Int32 maxTries, TaskBase task)
01/15/2009 13:55:32  1  WRN                      We are going to ignore all SocketExceptions that are not SocketError.ConnectionRefused
01/15/2009 13:55:32  1  INF                      Have not found a free port yet.  Number of tries is 1.  Min port we will try is 1024, Max port we will try is 49151
01/15/2009 13:55:32  1  INF                      Trying to see if port 23051 is free on machine DMX-FOOBAR2.  Min port we will try is 1024, Max port we will try is 49151
01/15/2009 13:55:57  1  INF                      A SocketException was thrown with SocketError TimedOut
01/15/2009 13:55:57  1  INF                      Entering function Common.BuildExceptionInformation
01/15/2009 13:55:57  1  INF                        Entering function Common.BuildExceptionMessage
01/15/2009 13:55:57  1  INF                          Entering function StringResourceManager.GetResourceString
01/15/2009 13:55:57  1  INF                            Resource id to be retrieved is ExceptionInfo for language English (United States)
01/15/2009 13:55:57  1  INF                            Resource retrieved id ExceptionInfo is An exception of type {0} was thrown.  Additional exception information: {1}
01/15/2009 13:55:57  1  INF                          Leaving function StringResourceManager.GetResourceString
01/15/2009 13:55:57  1  INF                        Leaving function Common.BuildExceptionMessage
01/15/2009 13:55:57  1  INF                      Leaving function Common.BuildExceptionInformation
01/15/2009 13:55:57  1  ERR                      An exception of type System.Net.Sockets.SocketException was thrown.  Additional exception information: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 192.168.0.11:23051
System.Net.Sockets.SocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 192.168.0.11:23051
   at System.Net.Sockets.TcpClient..ctor(String hostname, Int32 port)
   at Microsoft.SharePoint.PostSetupConfiguration.TaskCommon.GenerateRandomUnUsedPort(Int32 max, Int32 min, Int32 maxTries, TaskBase task)
01/15/2009 13:55:57  1  WRN                      We are going to ignore all SocketExceptions that are not SocketError.ConnectionRefused
01/15/2009 13:55:57  1  INF                      Have not found a free port yet.  Number of tries is 2.  Min port we will try is 1024, Max port we will try is 49151
01/15/2009 13:55:57  1  INF                      Trying to see if port [blah-blah, blah-blah, blah-blah] 

Hmmm...that's odd. I've never seen SharePoint struggle to find a random default to stuff into the Specify port number box when configuring SharePoint Central Administration.

It turns out the Config Wizard was choking on the IPv6 address returned for the hostname of the VM:

C:\Users\jjameson>ping dmx-foobar2

Pinging dmx-foobar2.windmx-dev.local [fe80::8d3a:793e:c6ee:67d9%12]:
Reply from fe80::8d3a:793e:c6ee:67d9%12: time<1ms
Reply from fe80::8d3a:793e:c6ee:67d9%12: time<1ms
Reply from fe80::8d3a:793e:c6ee:67d9%12: time<1ms
Reply from fe80::8d3a:793e:c6ee:67d9%12: time<1ms

Ping statistics for fe80::8d3a:793e:c6ee:67d9%12:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 0ms, Maximum = 0ms, Average = 0ms

I first tried disabling IPv6 in the properties of each network connection (meaning the LAN connection and the VPN connection), by clearing the checkbox for Internet Protocol Version 6 (TCP/IPv6). However, I found that pinging the machine name resulted in the same (IPv6) address. Using ipconfig /all, I found this was set on one of the "pseudo interfaces" that are new in Vista and Windows Server 2008 -- specifically, the Teredo Tunneling Pseudo-Interface.

Rather than blowing the rest of my afternoon trying to disable IPv6 in Windows Server 2008 through registry hacks, I chose instead to simply hardcode the hostname to 127.0.0.1 in the %SystemRoot%\System32\drivers\etc\hosts file.

Once I did this, I confirmed that the hostname of the VM resolved to an IPv4 address:

C:\Users\jjameson>ping dmx-foobar2

Pinging dmx-foobar2.windmx-dev.local [127.0.0.1] with 32 bytes of data:
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Reply from 127.0.0.1: bytes=32time<1ms TTL=128
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128

Ping statistics for 127.0.0.1:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 0ms, Maximum = 0ms, Average = 0ms

After restarting the Config Wizard, I was relieved to see that a random port was quickly found (which, of course, I always override anyway to use a consistent port across various environments -- LOCAL, DEV, TEST, and PROD). I was even more pleased to see SharePoint Central Administration come up on my pristine Windows Server 2008 VM.

[Update 2008-01-19: Note that after aliasing my local VM name to the loopback address (127.0.0.1), I had to use the workaround in KB 896861 in order to resolve "access denied" errors when indexing content:

Access is denied. Check that the Default Content Access Account has access to this content, or add a crawl rule to crawl this content. (The item was deleted because it was either not found or the crawler was denied access to it.)

]