Hosting a web Site on a local machine using the iisweb script

November 16th, 2007 by mrodriguez

Sometimes using default parameters instead of custom ones results to be the best idea, and also an excellent way to avoid unexpected behavior.

Context

  • Windows 2003 Server.
  • IIS 6.0.
  • No network present.

Problem

When trying to create a web site -on the context sited above- through the following command-line script

iisweb /create C:\MyWebSite “My Web Site” /d www.mywebsite.com /s localhost

an error occurs, and the script execution is halted.

Could not create root directory

Error &H800704CF: The network location cannot be reached. For information about network troubleshooting, see Windows Help.

This error takes place at the moment the iisweb.vbs script tries to create the physical directory corresponding to the location of content files for the Web site. In the example, this would be “C:\MyWebSite”.

Apparently, the /s localhost switch -used to force the execution of the script on the local computer- doesn’t work as we expected, because it seems to be that network resources are needed to locate the localhost machine. Remember that our machine is isolated from the outside world, while no network resources are present in this scenario.

Workaround

An easy way to solve this issue consist of omitting the /s switch on the command-line script. This drives to the default actions which will be to run the script directly on the local machine.

iisweb /create C:\MyWebSite “My Web Site” /d www.mywebsite.

… and Voilà! the web Site is successfully created.

Connecting to server …Done.

Server        = IIS-TEST

Site Name     = My Web Site

Metabase Path = W3SVC/1091467544

IP            = ALL UNASSIGNED

Host          = www.mywebsite.com

Port          = 80

Root          = C:\MyWebSite

App Pool      = DefaultAppPool (system default)

Status        = STARTED

Related links

Creating Web Sites Using Iisweb.vbs (IIS 6.0)