Scroll

Manual Application Installation

WARNING: This content may be outdated!

If the host application is deployed on site it may prove convenient and advantageous to integrate the installation of Exago into the host’s installer. This section will detail how to integrate the installation. To accomplish this task there must be an existing installation of Exago, Exago Web Service Api and Exago Scheduler from which to copy files and directories.

This section will show how to integrate the installation of:

Exago and Exago Web Service Api
Exago Scheduler Service

NOTE. Due to significant differences in IIS before and after version 7, some sections will provide separate explanations for versions prior to IIS 7 and after IIS 7.

Exago and Exago Web Service Api Installer Integration

Summary

The installer integration of Exago and/or the Exago Web Service Api has four steps:

  1. Copy the Exago and/or the Exago Web Service Api files to installation folders.
  2. Create IIS Virtual Directory to point to Exago/Exago Web Service Api.
  3. Configure IIS as required for Exago/Exago Web Service Api setup.
  4. Modify the system registry (optional).
NOTE. The installation of Exago Web Service Api is only used for clients who wish to develop using the Web Service Api instead of  the .NET Assembly.

Directory Structure

The directory structure should be preserved as follows:

Exago:

  • [Exago Physical Directory]
    • /Bin
    • /Config
    • /Images
    • /Temp

Exago Web Service API:

  • [ExagoApi Physical Directory]
    • /Bin
    • /Config

File Installation

The host installer should create a copy of all the files that are initially created by the Exago/Exago Web Service Api Installer.

Note: (Optional)

The following configuration files are not part of the initial Exago/Exago Web Service Api installation. Including the configuration files with the installation will help to minimize manual configuration. The files are stored in the following directory tree:

Exago:

  • /Config/
    • xml and/or WebReports.xml.enc

Exago Web Service Api:

  • /Config
    • xml

IIS Configuration

The method of creating new web applications and services differs depending on what version of IIS the server is using. Microsoft made significant changes to IIS versions 7+ which simplified creating new Web Sites, Virtual Directories, etc.

NOTE. Verify that the Virtual Directory does not exist before attempting to create the new one.

IIS Version 5.0-6.0

Create Virtual Directory

A virtual directory requires the following input:

  • siteName – Name of the IIS Web Site where it will be installed. (ex. ‘Default Web Site’)
  • vDirName – Name of Virtual Directory for the installation (ex. ‘Exago’ or ‘ExagoApi’)
  • physicalPath – Physical installation path. (ex. ‘C:\Program Files\Exago\Exago’)

The following C# code provides an example of how to set these properties.

public void CreateVDir(string siteName, string vDirName, string physicalPath)
{
System.DirectoryServices.DirectoryEntry oDE;
System.DirectoryServices.DirectoryEntries oDC;
System.DirectoryServices.DirectoryEntry oVirDir;

oDE = new DirectoryEntry(siteName + "/Root");

//Get Default Web Site
	oDC = oDE.Children;

// Delete before it re-create
bool isVDirExists = true;
try
{
DirectoryEntry dirEnt = oDC.Find(vDirName,  oDE.SchemaClassName.ToString());

if (dirEnt != null)
{
//Changed to Update virtual directory physical path.
//If virtual directory already exist do not delete and
//recreate.
dirEnt.Properties["Path"].Value = physicalPath;
dirEnt.CommitChanges();
}
}
catch (DirectoryNotFoundException)
{
isVDirExists = false;
}
catch (COMException comEx)
{
if (comEx.Message == "Exception from HRESULT: 0x80005008")
return;
else
throw;
}

if (isVDirExists)
return;

//Add row
oVirDir = oDC.Add(vDirName, oDE.SchemaClassName.ToString());

//Commit changes for Schema class File
oVirDir.CommitChanges();


//Create physical path if it does not exists
if (!Directory.Exists(physicalPath))
{
Directory.CreateDirectory(physicalPath);
}

//Set virtual directory to physical path
oVirDir.Properties["Path"].Value = physicalPath;

//Set read access
oVirDir.Properties["AccessRead"][0] = true;

//Create Application for IIS Application (as for ASP.NET)
oVirDir.Invoke("AppCreate", true);
oVirDir.Properties["AppFriendlyName"][0] = vDirName.Substring(vDirName.LastIndexOf('/') + 1);
oVirDir.Properties["DefaultDoc"][0] = "Home.aspx";
oVirDir.Properties["EnableDefaultDoc"][0] = false;
oVirDir.Properties["AppIsolated"][0] = 2;

//Save all the changes
oVirDir.CommitChanges();
}

Configure Framework

All Exago components require .NET Framework 4.0. Thus, IIS needs to be set to an app pool that also uses .NET Framework 4.0. The host installer should verify that this Framework is currently installed on the web server.

The following C# code provides an example of how to check and set the proper Framework.

public static void SetFramework(string webSitePath)
{
try
       {
string frameworkPath = Environment.GetEnvironmentVariable("WINDIR") +   @"\microsoft.net\framework";

             // Check to see if the system has the 64 bit version of .NET
             if (Directory.Exists(frameworkPath + "64"))
             {
             	frameworkPath += "64";
             }

             // Set the .NET Framework to .NET 4.0
             string strExe = frameworkPath + @"\v4.0.30319\aspnet_regiis.exe";
             if (File.Exists(strExe))
             {
                    ProcessStartInfo pi = new ProcessStartInfo();
                    pi.FileName = strExe;
                    pi.Arguments = "-s " + webSitePath.Replace(@"IIS://localhost/", "");
                    pi.UseShellExecute = false;
                    pi.CreateNoWindow = true;
                    Process proc = Process.Start(pi);
                    proc.WaitForExit();
       	}
       }
       catch
       {
       throw;
       }
}

IIS Version 7+

The following is a C# code sample of how to create a new IIS installation of Exago/Exago Web Service API, using Microsoft.Web.Administration.dll. The code requires the following input:

  • siteName – Name of the IIS Web Site where it will be installed. (ex. ‘Default Web Site’)
  • vDirName – Name of Virtual Directory for the installation (ex. ‘Exago’ or ‘ExagoApi’)
  • physicalPath – Physical installation path. (ex. ‘C:\Program Files\Exago\Exago’)
public new void CreateVDir(string siteName, string vDirName, string physicalPath)
{
try
{
ServerManager iisManager = new ServerManager();
string virtDirName = @"/" + vDirName;

// Check if Application/Virtual Directory exists
if (iisManager.Sites[siteName].Applications[virtDirName] != null)
{
iisManager.Sites[siteName].Applications[virtDirName].VirtualDirectories[@"/"].PhysicalPath =
	physicalPath;
}
// Create new Application/Virtual Directory
else
{
iisManager.Sites[siteName].Applications.Add(virtDirName, physicalPath);

Microsoft.Web.Administration.Application app =
iisManager.Sites[siteName].Applications[virtDirName];

app.ApplicationPoolName = "DefaultAppPool";
}

// Commit changes to the webserver
iisManager.CommitChanges();
}
catch
{
throw;
}
}

Exago Scheduler Installer Integration

Summary

The installer integration of the Exago Scheduler has six steps:

  1. Check to see if the Exago Scheduler is running as a Windows Service (if so stop this service).
  2. Copy the Exago Scheduler files to installation folders.
  3. Modify the system registry (optional).
  4. Modify the security settings on the Exago Scheduler directory.
  5. Create a new Windows Service for the Exago Scheduler
  6. Enable the Exago Scheduler service.

File Installation

Before running the installation, the Windows Services should be checked to see if the Exago Scheduler is currently installed and/or running as a service. If the Exago Scheduler is currently installed and/or running as a service it should be shut down. The host installer should then create a copy of all the files that are initially created by the Exago Scheduler Installer.

NOTE. Overwrite the file ExagoScheduler.xml with a version configured for the host application.

The following C# code provides an example of how to stop the scheduler service if it is running.

ServiceState serviceSt = WindowsServiceInstaller.GetServiceStatus(“ExagoScheduler”);

// check to see if the Exago Scheduler service exists
if (serviceSt != ServiceState.NotFound && serviceSt != ServiceState.Unknown)
{
CreateServiceDelegate stDel = new CreateServiceDelegate(WindowsServiceInstaller.StopService);
stDel(“ExagoScheduler”);

for (int ProgCtr = 0; ProgCtr <= 120; ProgCtr++)
{
Thread.Sleep(1000);
serviceSt = WindowsServiceInstaller.GetServiceStatus(“ExagoScheduler”);

if (serviceSt == ServiceState.Stop)
break;

if (InvokeRequired)
Invoke(new Change(OnChange), ProgCtr);

(sender as BackgroundWorker).ReportProgress(ProgCtr);
}
}

Directory Security Settings

The Exago Scheduler service will require changes to the security settings of the installation directory to enable Windows to run the program scheduler.exe as a Windows Service.

The following C# code provides an example of how to make the necessary security changes. It requires the following input.

  • dirName – Physical path to Exago Scheduler (ex. ‘c:\Program Files\Exago\ExagoScheduler\’)
private void SetDirSecurity(string dirName)
{
try
{
if (dirName == null)
return;

if (!Directory.Exists(dirName))
return;

DirectoryInfo dirInfo = new DirectoryInfo(dirName);

// get a DirectorySecurity object that represents the current
// security settings
DirectorySecurity dirSecurity = dirInfo.GetAccessControl();

// Add the FileSystemAccessRule to the security settings
dirSecurity.AddAccessRule(new FileSystemAccessRule("LOCAL SERVICE",
FileSystemRights.FullControl, AccessControlType.Allow));
dirSecurity.AddAccessRule(new FileSystemAccessRule("LOCAL SERVICE",
		FileSystemRights.FullControl,
InheritanceFlags.ContainerInherit | InheritanceFlags.ObjectInherit,
PropagationFlags.InheritOnly, AccessControlType.Allow));

// Set the new access settings
try
{
dirInfo.SetAccessControl(dirSecurity);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
catch (Exception ex)
{
MessageBox.Show(this,"Unable to set privileges on install directory: " + dirName +
	".  Please set 'LOCAL SERVICE' privileges.\n\nException: " + ex.Message, "Error");
}
}

Windows Service Creation

Before installing the Exago Scheduler as a new service, verify that it is not installed and/or running. If the Exago Scheduler is not installed, install the software and make sure it is running.

The following C# code provides an example of how to make this check.


Hidden Article Information

Article Author
Alex Agoado
created 2015-12-15 17:10:25 UTC
updated 2017-06-01 14:02:18 UTC

Labels
Installing Exago, read/write, IIS app pool, manual installation, installer integration, configuring IIS, IIS, IIS config, IIS configuration, app pool, .NET Framework, security settings, windows service, registry, windows registry,
Have more questions? Submit a request