I'm trying to deploy an ASP.NET application using InnoSetup.
I need to perform the following tasks:
- Create an IIS application.
- Create a new IIS application pool and set it's .NET version to 4.
- Set the application pool of the new application to the new application pool.
I have found a script to create a virtual directory, but I need an application and application pool:
procedure CreateIISVirtualDir();
var
IIS, WebSite, WebServer, WebRoot, VDir: Variant;
ErrorCode: Integer;
begin
{ 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', 'eipwebv4');
WebRoot.SetInfo();
except
end;
VDir := WebRoot.Create('IIsWebVirtualDir', 'eipwebv4');
VDir.AccessRead := True;
VDir.AccessScript := TRUE;
VDir.AppFriendlyName := 'Easy-IP Web Client';
VDir.Path := ExpandConstant('{app}');
try
VDir.AppPoolId := 'Classic .NET AppPool';
except
end;
VDir.AppCreate(True);
VDir.SetInfo();
end;