简体   繁体   English

Inno安装程序安装网站不在根目录中

[英]Inno setup install website not in Root

I have created an installer for a classic asp website. 我已经为经典的ASP网站创建了一个安装程序。 I managed to install website in my "Root" (Default Web Site) ok. 我设法在“根”(默认网站)中安装了网站。 But I would like to install website under "Sites" but not in "Root" for exmaple in an existing "Demo" site. 但是我想将网站安装在“站点”下,而不要安装在“根”下,以便在现有的“演示”站点中安装示例。

Any idea? 任何想法? I think the key is in line: 我认为关键在于:

WebRoot := WebServer.GetObject('IIsWebVirtualDir', 'Root');

Some code I used to add the website to IIS "Root" in case is needed: 我用于在需要时将网站添加到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;

I am not expert on COM automation objects but what about passing 'Sites\\' as parameter in: 我不是COM自动化对象的专家,但是如何在以下情况中传递“ Sites \\”作为参数呢?

VDir := WebRoot.Create('IIsWebVirtualDir', 'Sites\' + WebAppName); 

Is it possible to create subdirs in WebRoot.Create? 是否可以在WebRoot.Create中创建子目录? I think it is worth the try :) 我认为值得尝试:)

Or the second idea, passing 'Sites' in: 或第二个想法,传入“站点”:

WebRoot := WebServer.GetObject('IIsWebVirtualDir', 'Sites');

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM