donderdag, december 08, 2005

Adding a Visual basic (vbs) script into a web setup project to add a virtual directory in ISS

Beneath there is a possible solution for the problem, but visual basic scripting is not good for using in setup projects (sometimes virusscanners block it!)

Because of the strange bug in IIS (look here), I used vbs to make the virtual dirs. But there is a better way, create & configure the Virtual Directory's
in a class that will run during setup:

< RunInstaller(True)> Public Class WebInstaller Inherits System.Configuration.Install.Installer
' Some Component Designer generated code
Public Overrides Sub Install(ByVal state As IDictionary)

' Write here code to do during setup (creating Vdirs, .....)

End Sub


Look at the url below to read about "Customizing Windows and Web setup projects"

All about Installers - Customizing Windows and Web setup projects &
Conditional Install of Desktop and Quick Launch Shortcuts



You must create a virtual directory linked to a path in a script, because in a web setup project it isn't possible to create a virtual dir linked to a path

Also I had to set some options of that directory:

Set Directory Settings to Integrated Windows authentication (without Anonymous access):
IIsWebVDirObj.Put "AuthFlags", 4
(All the AuthFlags" options:

http://msdn.microsoft.com/library/en-us/iissdk/html/14b96ff9-94e6-49f4-8d61-160111041bd5.asp)
(Tip: if you want to combine security setting, like Integrated Windows authentication AND Anonymous access, set

the AuthFlags to 4+1 , the 1 from Anonymous authentication)

IIsWebVDirObj.Put "Path", "C:\Program Files\Unique World Software\InfoView"
This is the path where the virtual directory is referenced to

Set the Read Access to true
IIsWebVDirObj.Put "AccessRead", True

Set the Script Access to true
IIsWebVDirObj.Put "AccessScript", True


More info:
Creating Sites and Virtual Directories Using ADSI
IIsWebVirtualDir (ADSI)
IIS ADSI Provider Overview
Remove IIS Anonymous Access
IIS ADSI arguments info for create,delete,.... of virtual dir

Geen opmerkingen: