【问题标题】:Inno setup install website not in RootInno setup 安装网站不在 Root 中
【发布时间】:2013-10-03 13:10:32
【问题描述】:

我已经为一个经典的 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;

【问题讨论】:

    标签: iis installation inno-setup


    【解决方案1】:

    我不是 COM 自动化对象方面的专家,但是如何将“站点”作为参数传递:

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

    是否可以在 WebRoot.Create 中创建子目录?我认为值得一试:)

    或者第二个想法,传入“站点”:

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

    【讨论】:

      猜你喜欢
      • 2020-04-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-07-04
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多