[英]Inno setup install website not in Root
我已经为经典的ASP网站创建了一个安装程序。 我设法在“根”(默认网站)中安装了网站。 但是我想将网站安装在“站点”下,而不要安装在“根”下,以便在现有的“演示”站点中安装示例。
任何想法? 我认为关键在于:
WebRoot := WebServer.GetObject('IIsWebVirtualDir', 'Root');
我用于在需要时将网站添加到IIS“根”的一些代码:
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.AspEnableParentPaths := True;
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;
我不是COM自动化对象的专家,但是如何在以下情况中传递“ Sites \\”作为参数呢?
VDir := WebRoot.Create('IIsWebVirtualDir', 'Sites\' + WebAppName);
是否可以在WebRoot.Create中创建子目录? 我认为值得尝试:)
或第二个想法,传入“站点”:
WebRoot := WebServer.GetObject('IIsWebVirtualDir', 'Sites');
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.