设置虚拟目录

procedure SetIISDir(Dir,BieMing:string);

var

I:IADSContainer;

ADS:IADS;

begin

if ADSGetObject('IIS://localhost/w3svc',IID_IADSContainer,IUnkown(I))=S_OK then

begin

ADS :=IADS(I.GetObject('IISWebServer','1'));

if ADS.QueryInterface(IID_IADSContainer,I)=S_OK) then

begin

ADS :=IADS(I.GetObject('IISWebVirtualDir','Root');

if ADS.QueryInterface(IID_IADSContainer,I)=S_OK) then

begin

ADS :=IADS(I.Create('IISWebVirtualDir',BieMing));

ADS.Put('AccessRead','True');

ADS.Put('Path',Dir);

ADS.SetInfo;

end;

end;

end;

原文地址:https://www.cnblogs.com/djcsch2001/p/2035789.html