Visualizzazione dei risultati da 1 a 2 su 2

Discussione: Inno Setup vs IIS7

  1. #1

    Inno Setup vs IIS7

    Buonasera a tutti, spero che qualcuno possa darmi una mano perché non so più dove sbattere la testa.
    Ho fatto un'applicazione in ASP.NET e ho necessità di distribuirla con Inno Setup (così riesco a fare i check necessari ed eventualmente ad installare .NET 3.5 e SQL SERVER EXPRESS).

    Tra gli esempi forniti assieme al programma ho trovato una porzione di codice che va a configurare IIS aggiungendo il nuovo sito. Purtroppo questo funziona solo su IIS6.
    Su IIS7 viene generata un'eccezione quando faccio
    IIS := CreateOleObject('IISNamespace');
    Sotto vi posto tutto il codice per Inno Setup.

    Grazie in anticipo a tutti!

    const
    IISServerName = 'localhost';
    IISServerNumber = '1';
    IISURL = 'http://127.0.0.1';

    function InitializeSetup(): Boolean;
    var
    IIS, WebSite, WebServer, WebRoot, VDir: Variant;
    ErrorCode: Integer;
    begin
    if MsgBox('Setup will now connect to Microsoft IIS Server ''' + IISServerName + ''' and create a virtual directory. Do you want to continue?', mbInformation, mb_YesNo) = idNo then
    Exit;

    { Create the main IIS COM Automation object }

    try
    IIS := CreateOleObject('IISNamespace');
    except
    RaiseException('Please install Microsoft IIS first.'#13#13'(Error ''' + GetExceptionMessage + ''' occurred)');
    end;

    { Connect to the IIS server }

    WebSite := IIS.GetObject('IIsWebService', IISServerName + '/w3svc');
    WebServer := WebSite.GetObject('IIsWebServer', IISServerNumber);
    WebRoot := WebServer.GetObject('IIsWebVirtualDir', 'Root');

    { (Re)create a virtual dir }

    try
    WebRoot.Delete('IIsWebVirtualDir', 'innosetup');
    WebRoot.SetInfo();
    except
    end;

    VDir := WebRoot.Create('IIsWebVirtualDir', 'innosetup');
    VDir.AccessRead := True;
    VDir.AppFriendlyName := 'Inno Setup';
    VDir.Path := 'C:\inetpub\innosetup';
    VDir.AppCreate(True);
    VDir.SetInfo();

    MsgBox('Created virtual directory ''' + VDir.Path + '''.', mbInformation, mb_Ok);

    { Write some html and display it }

    if MsgBox('Setup will now write some HTML and display the virtual directory. Do you want to continue?', mbInformation, mb_YesNo) = idNo then
    Exit;

    ForceDirectories(VDir.Path);
    SaveStringToFile(VDir.Path + '/index.htm', '<html><body>Inno Setup rocks!</body></html>', False);
    if not ShellExec('open', IISURL + '/innosetup/index.htm', '', '', SW_SHOWNORMAL, ewNoWait, ErrorCode) then
    MsgBox('Can''t display the created virtual directory: ''' + SysErrorMessage(ErrorCode) + '''.', mbError, mb_Ok);
    end;

  2. #2
    Mi rispondo da solo al post di ieri. Nel caso in cui servisse a qualcuno con i miei stessi problemi posto un link che ho trovato molto interessante ed utile.

    PowerShell Snap-in: configurare IIS7

    Purtroppo la configurazione di IIS7 è un po' più complicata rispetto ai suoi predecessori.

    Ciao a tutti!

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.