Errors when trying to use Site Packager on IIS 7.0

When attempting to pack a site or unpack a site you may received errors or failures during the packing or unpacking process. This may be caused by various factors but I wanted to point out one cause that is new when using IIS 7.0.

In IIS 7.0 you have the ability to configure a web site to only have an HTTPS binding. In previous versions of IIS you would always have at least one HTTP binding. If you have configured a web site on the Commerce Server machine with only a HTTPS binding then the site packager may fail because because the site packager is designed to read all IIS sites configured on the server and gather some basic information on each site. One of the items that we require is the non-secure binding information.

If the site is configured to only have an HTTPS binding then the non-secure binding property will be NULL and will cause the site packager to fail.

You can use the below .vbs script on your IIS / Commerce Server machine to read the same information the site packager will read and if the script fails then you can identify which IIS site is causing the issue.

******

'The code below simulates Commerce Server Site Packager checking IIS health.
'This IIS checking happens when you click the "next" button at the first dialog of the site unpacking.
'This code helps you to find out where the check is failing.

set oNet=CreateObject("WScript.Network")

sLocalMachine = oNet.ComputerName

Set webServer = GetObject("IIS://" & sLocalMachine & "/w3svc")

msgbox "Web Server "+ sLocalMachine +" has the following Web Sites:"
For Each webSite In webServer
     If IsNumeric(webSite.Name) Then

    sName = webSite.Name
    sComment = webSite.ServerComment
    sBind = webSite.ServerBindings
    sAppPool = webSite.AppPoolId
    msgbox "Web Instance Number: "+sName+" / "+"Web Site Name: "+sComment+" / "+" Binding: "+sBind(0)
    msgbox sComment+"'s Application Pool: "+sAppPool
    Set vroot = webSite.GetObject("IIsWebVirtualDir", "Root")
    msgbox sComment+"'s Root Directory: "+vroot.path
     End If
Next

set onet=nothing
set webserver=nothing
set webSite=nothing
set vroot=nothing

******