Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

How to config IIS virtual directories


3 replies to this topic

reback

reback
  • Members
  • 1 posts

Posted 29 December 2003 - 15:03

How to config IIS virtuall directories ..
I want to set a IIS virtual directories and ftp virtual directories on installing
and Uninstall all that virtual directories on unistalling....
How can I do?
Please Help me....

asyncsoftware

asyncsoftware
  • Members
  • 1 posts

Posted 08 January 2004 - 21:19

There is a good sample C++ project on this site that will add/delete virtual directories, as well as add/delete ifilters.

My problem is getting this project to compile in VS Studio 2003. I keep getting the following error messages:

1. activeds.tlh(523): error C2011: '_LARGE_INTEGER' : 'union' type redefinition
2. AsyncInstall.cpp(1068): error C2664: 'ADsGetObject' : cannot convert parameter 1 from 'const char [29]' to 'LPCWSTR'

Does anyone know how to fix this?


Stefan Krueger

Stefan Krueger

    InstallSite.org

  • Administrators
  • 13,269 posts

Posted 09 January 2004 - 10:59

Another option would be the IIS configuration view in DevStudio. However that's only available in MSI projects, not in InstallScript projects.

mabr

mabr
  • Members
  • 3 posts

Posted 04 February 2004 - 12:40

It's quite easy to access IIS from installscript. using ADSI.
Below are some basic functions for creating and deleting a virtual directory.
The code is not tested, but I think it is more or less correct.

For more information about ADSI look at Microsoft's website.

/Max

Add virtual directory:

CODE

function CreateVirtDir(sVirtDir, sVirtDirPath)
OBJECT oIISRoot;
OBJECT oIISDir;
begin
try
 set oIISRoot = CoGetObject("IIS://LocalHost/W3SVC/1/ROOT","");
 
 if IsObject(oIISRoot) then
  set oIISDir = oIISRoot.Create("IIsWebVirtualDir", sVirtDir);
  oIISDir.Put("Path",sVirtDirPath);
  oIISDir.Put("AccessRead","true");
  oIISDir.Put("AccessWrite", "false");
  oIISDir.Put("EnableDirBrowsing", "false");
  oIISDir.Put("AppFriendlyName",sVirtDir);
  oIISDir.SetInfo();
 endif;  
catch
endcatch;
end;


Delete Virtual directory:
CODE

function DeleteVirtDir(sVirtDir)
OBJECT oIISRoot;
begin
try
 set oIISRoot = CoGetObject("IIS://LocalHost/W3SVC/1/ROOT","");
 if IsObject(oIISRoot) then
  oIISRoot.Delete("IIsWebVirtualDir",sVirtDir);
 endif;  
catch
endcatch;
end;

Edited by mabr, 04 February 2004 - 12:48.