我为经典的 asp 网站创建了一个安装程序。我可以将应用程序添加到 IIS 并设置应用程序池、友好名称和允许脚本。我也想设置“启用父路径”。
任何想法?是否有任何 EnableParentPaths = true?
这是我用来将网站添加到 IIS 以备不时之需的 somw 代码:
if (IISOptionsPage.Values[1] <> '') then begin
IISDefAppPool := IISOptionsPage.Values[1];
end else begin
IISDefAppPool := ExpandConstant('{#IISDefaultAppPool}');
end;
{ Create the main IIS COM Automation object }
try
IIS := CreateOleObject('IISNamespace');
except
RaiseException('IIS is not installed?.'#13#13'(Error: ''' + GetExceptionMessage );
end;
{ Connect to the IIS server }
WebSite := IIS.GetObject('IIsWebService', IISServerName + '/w3svc');
WebServer := WebSite.GetObject('IIsWebServer', IISServerNumber);
WebRoot := WebServer.GetObject('IIsWebVirtualDir', 'Root');
WebAppName := ExtractLastDir(ExpandConstant('{app}'));
{ (Re)create a virtual dir }
try
WebRoot.Delete('IIsWebVirtualDir', WebAppName);
WebRoot.SetInfo();
except
end;
VDir := WebRoot.Create('IIsWebVirtualDir', WebAppName);
VDir.AccessRead := True;
VDir.AccessScript := True;
VDir.AppFriendlyName := WebAppName;
VDir.Path := ExpandConstant('{app}');
try
VDir.AppPoolId := IISDefAppPool;
except
MsgBox('AppPool not set.'#13#13'(Error: ''' + GetExceptionMessage, mbInformation, mb_Ok);
end;
try
VDir.AppCreate(True);
except
MsgBox('App not created.'#13#13'(Error: ''' + GetExceptionMessage, mbInformation, mb_Ok);
end;
try
VDir.SetInfo();
except
MsgBox('Info no set.'#13#13'(Error: ''' + GetExceptionMessage, mbInformation, mb_Ok);
end;