安装ASP.NET应用程序的先决条件是什么?

nor*_*aul 7 .net asp.net iis installation inno-setup

我们有一个ASP.NET 2.0应用程序,可以作为试用版下载.因此,我们无法控制将要安装的环境.尽管我们努力生产可靠的安装程序,但仍然有很多用户报告问题.

我们使用Web部署项目生成编译的.net文件.然后,我们获取输出并通过VS 2010部署项目运行它以生成msi安装程序.

以下是我们遇到的几个问题:

  • 似乎msi安装程序与IIS7不兼容.为了正确安装,需要安装IIS6兼容性,否则它会失败并且没有错误.
  • 即使"RemovePreviousVersions"设置为true,安装程序也几乎从不卸载该版本,只是抛出一个错误,说明该应用程序已经安装.

我们之前尝试过使用InnoSetup安装程序.它在某种程度上起作用,但是我们遇到了安装的应用程序连接到错误的应用程序池的问题,并且从未找到通过InnoSetup脚本定义应用程序池的方法.

有人可以给我一个明确的列表,列出在Windows XP或更高版本的配置未知的计算机上运行和运行ASP.NET应用程序所需的内容吗?例如,检查.NET 2.0是否已安装,检查是否安装了II6,将文件复制到x,创建虚拟目录等.

更好的是,是否有人知道安装程序(或InnoSetup扩展程序)可以为您完成大部分设置?

nor*_*aul 0

在审查了所有选项后,我决定保留 msi 安装程序,但在 inno 安装脚本中添加先决条件检查。

这是脚本

procedure DialogInfo(const Msg: String);
begin
  MsgBox(Msg , mbInformation, mb_OK); 
end;

function IISInstalled: Boolean;
begin
  Result := RegKeyExists(HKEY_LOCAL_MACHINE, 'SOFTWARE\Microsoft\InetStp');
end;

function GetIISMajorVersion: Integer;
var 
  Vers: Cardinal;
begin
  if (IISInstalled) and
     (RegQueryDWordValue(HKEY_LOCAL_MACHINE, 'SOFTWARE\Microsoft\InetStp', 'MajorVersion', Vers)) then
    Result := Vers
  else
    Result :=0;    
end;

function IISManagementConsoleInstalled: Boolean;
var
  IIS: Variant;
begin
  try
    IIS := CreateOleObject('IISNamespace');

    Result := TRUE;
  except
    Result := FALSE;
  end;
end;

function WindowsMinorVersion: Integer;
var
  Version: TWindowsVersion;
begin
  GetWindowsVersionEx(Version);

  Result := Version.Minor;
end;

function WindowsMajorVersion: Integer;
var
  Version: TWindowsVersion;
begin
  GetWindowsVersionEx(Version);

  Result := Version.Major;
end;

function WindowsServer: Boolean;
var
  Version: TWindowsVersion;
begin
  GetWindowsVersionEx(Version);

  Result := Version.ProductType = VER_NT_SERVER;
end;

function IsWindows7: Boolean;
begin 
  Result := (WindowsMajorVersion = 6) and (WindowsMinorVersion = 1) and (not WindowsServer);
end;

function IsWindowsVista: Boolean;
begin 
  Result := (WindowsMajorVersion = 6) and (WindowsMinorVersion = 0) and (not WindowsServer);
end;

function IsWindowsXP: Boolean;
begin 
  Result := (WindowsMajorVersion = 5) and (WindowsMinorVersion = 1) and (not WindowsServer);
end;

function IsWinServer2003: Boolean;
begin 
  Result := (WindowsMajorVersion = 5) and (WindowsMinorVersion = 2) and (WindowsServer);
end;

function IsWinServer2008: Boolean;
begin 
  Result := (WindowsMajorVersion = 6) and ((WindowsMinorVersion = 0) or (WindowsMinorVersion = 1)) and (WindowsServer);
end;

function IsHomeEdition: Boolean;
var
  Version: TWindowsVersion;
begin
  GetWindowsVersionEx(Version);

  Result := Version.SuiteMask AND VER_SUITE_PERSONAL <> 0 ;
end;

function CheckIISPrerequisites: Boolean;
var
  IISVersion: Integer;
  Msg: String;
begin
  Result := FALSE;

  case GetIISMajorVersion of
    0:
      begin
        if IsHomeEdition then
          Msg := 'The Easy-IP Web Server requires Internet Information Services (IIS). IIS cannot be installed on the Home edition of Windows.'
        else
        begin      
          Msg := 'The Easy-IP Web Server requires Internet Information Services to be enabled on this machine. To enable IIS: ' +#10 + #10;

          if IsWindowsXP then
            Msg := Msg + '1) Open Control Panel then Add or Remove Programs.' + #10 +
                         '2) Click on Add/Remove Windows Components.' + #10 +
                         '3) Find Internet Information Services (IIS) amd check it.' + #10 +
                         '4) Click Next then Finish.' else

          if IsWinServer2003 then
            Msg := Msg + '1) Open Manage Your Server' + #10 +
                         '2) Click on Add or Remove a Role.' + #10 +
                         '3) Click Next.' + #10 +
                         '4) Select Application server (IIS, ASP.NET)' + #10 +
                         '5) Click Next.' + #10 +
                         '6) Check Enable ASP.NET.' + #10 +
                         '7) Click Next, then Next again.' else

          if IsWinServer2008 then
            Msg := Msg + '1) Open Server Manager.' + #10 +
                         '2) Click on Roles.' + #10 +
                         '3) Click Add Roles.' + #10 +
                         '4) When the Wizard appears, click Next.' + #10 +
                         '5) Find Web Server(IIS) and check it.' + #10 +
                         '6) Click Next twice.' + #10 +
                         '7) Find Application Development and check it.' + #10 +
                         '8) Find IIS 6 Management Compatibility (under Management Tools) and check it along with all it''s children.' + #10 +
                         '9) Click Next, then Install.' 
          else         

            // Vista, Win7 or later
            Msg := Msg + '1) Open Control Panel then Programs and Features.' + #10 +
                         '2) Click on Turn Windows Features on or off.' + #10 +
                         '3) Check Internet Information Services.' + #10 +
                         '4) Under the Internet Information Services node, expand Web Management Tools and check IIS Management Console.' + #10 +
                         '5) Click OK.';
        end; 
      end;

    5, 6: 
      begin
        Result := IISManagementConsoleInstalled;

        if not Result then
          Msg := 'Unable to install the Easy-IP Web Server as the IIS Management Console could not be initiated. Please contact support@easy-ip.net for more information.';
      end;

    7: 
      begin
        Result := IISManagementConsoleInstalled;

        if not Result then
        begin
          Msg := 'Internet Information Services is installed, but in order to install the Easy-IP Web Server, you must also enable the IIS Management Console. To enable the IIS Management Console:' + #10 + #10;

          if WindowsServer then
            Msg := Msg + '1) Open Server Manager and click on Roles.' + #10 +
                         '2) Under Web Server (IIS), click Add Role Services.' + #10 +
                         '3) Find Application Development and make sure it''s checked.' + #10 +
                         '4) Find IIS 6 Management Compatibility (under Management Tools) and check it along with all it''s children.' + #10 +
                         '5) Click Next, then Install.' 
          else
            Msg := Msg + '1) Open Control Panel then Programs and Features.' + #10 +
                         '2) Click on Turn Windows Features on or off.' + #10 +
                         '3) Under the Internet Information Services node, expand Web Management Tools then check IIS Management Console.' + #10 +
                         '4) Click OK.'; 
        end;
      end;  
  end; // of case

  if not Result then
    DialogInfo(Msg);
end;
Run Code Online (Sandbox Code Playgroud)