Table of Contents

Installing Microsoft Internet Information Services

Word of Warning

When installing HgLab on a clean system, it's recommended to install IIS before installing .NET Framework. Installing them the other way around doesn't cause any problems, but requires an extra step. See the Registering ASP.NET in IIS section below.


All the instructions below use DISM to install Internet Information Services.

Please note that these commands must be executed in an Elevated Command Prompt, which is summoned by right-clicking on the Command Prompt element in the Start menu and picking Run as Administrator

Microsoft Windows Server 2008/Microsoft Windows 7

Run the following command in an Elevated Command Prompt:

dism /online /enable-feature /featurename:IIS-WebServerRole /featurename:IIS-WebServer /featurename:IIS-CommonHttpFeatures /featurename:IIS-Security /featurename:IIS-RequestFiltering /featurename:IIS-StaticContent /featurename:IIS-DefaultDocument /featurename:IIS-HttpErrors /featurename:IIS-HttpRedirect /featurename:IIS-ApplicationDevelopment /featurename:IIS-ISAPIExtensions /featurename:IIS-ISAPIFilter /featurename:IIS-HealthAndDiagnostics /featurename:IIS-HttpLogging /featurename:IIS-RequestMonitor /featurename:IIS-HttpTracing /featurename:IIS-Performance /featurename:IIS-HttpCompressionStatic /featurename:IIS-HttpCompressionDynamic /featurename:IIS-WebServerManagementTools /featurename:IIS-ManagementConsole /featurename:IIS-ManagementScriptingTools /featurename:WAS-WindowsActivationService /featurename:WAS-ProcessModel /featurename:WAS-ConfigurationAPI

Microsoft Windows Server 2012 and Later

Run the following command in an Elevated Command Prompt:

dism /online /enable-feature /featurename:NetFx4ServerFeatures /featurename:NetFx4 /featurename:NetFx4Extended-ASPNET45 /featurename:IIS-WebServerRole /featurename:IIS-WebServer /featurename:IIS-CommonHttpFeatures /featurename:IIS-Security /featurename:IIS-RequestFiltering /featurename:IIS-StaticContent /featurename:IIS-DefaultDocument /featurename:IIS-HttpErrors /featurename:IIS-HttpRedirect /featurename:IIS-ApplicationDevelopment /featurename:IIS-ApplicationInit /featurename:IIS-NetFxExtensibility45 /featurename:IIS-ISAPIExtensions /featurename:IIS-ISAPIFilter /featurename:IIS-ASPNET45 /featurename:IIS-HealthAndDiagnostics /featurename:IIS-HttpLogging /featurename:IIS-RequestMonitor /featurename:IIS-HttpTracing /featurename:IIS-Performance /featurename:IIS-HttpCompressionStatic /featurename:IIS-HttpCompressionDynamic /featurename:IIS-WebServerManagementTools /featurename:IIS-ManagementConsole /featurename:IIS-ManagementScriptingTools /featurename:WAS-WindowsActivationService /featurename:WAS-ProcessModel /featurename:WAS-ConfigurationAPI

When finished, confirm that the Web server works by opening up http://localhost/ in Internet Explorer.

Installing Microsoft .NET Framework

Download the offline installer for Microsoft .NET Framework 4.6.2.

Follow the installer prompts. Note that a reboot might be required.

Registering ASP.NET in IIS

If you installed IIS after installing .NET Framework, there's an additional step you'll need to perform.

On a 32-bit system, run following commands in an Elevated Command Prompt:

%windir%\\framework\v4.0.30319\aspnet_regiis.exe -ir

On a 64-bit system, run following commands in an Elevated Command Prompt:

%windir%\\framework64\v4.0.30319\aspnet_regiis.exe -ir

Installing Microsoft SQL Server

Microsoft SQL Server 2008 Express is available free of charge and can be downloaded here. Note that there is a number of limitations for Express edition, notably:

  • Constrained to a single CPU (in Microsoft SQL Server 2012 Express this limitation has been changed to "The lesser of one socket or four cores", so multi-threading is possible)
  • 1 GB RAM
  • 4 GB database size (raised to 10GB starting from Microsoft SQL Server 2008 R2 Express)

All of this is more than enough, though, to run HgLab and to scale it to hundreds of repositories.

Authentication Methods

When installing Microsoft SQL Server, make sure to enable Mixed Mode Authentication.

Microsoft SQL Server, even Express edition, is a complex beast to install. See Installing SQL Server 2008 Express Guidance for instructions. If you have any questions, please contact HgLab Support.

You might also need to install Microsoft SQL Server 2008 Management Studio.

Creating Database

Connect to the Microsoft SQL Server instance and run the following script:

create database [hglab];
use [master]
create login [hglab] with 
    password = N'hglab', /* Be sure to change the password */
    default_database = [hglab], 
    check_expiration = off, 
    check_policy = off
use [hglab]
create user [hglab] for login [hglab]
exec sp_addrolemember N'db_datareader', N'hglab'
exec sp_addrolemember N'db_datawriter', N'hglab'
exec sp_addrolemember N'db_ddladmin', N'hglab'

Those with DBA-fu can tweak things accordingly.

Note that HgLab performs all database schema migrations internally: you don't need to create any tables, nor any tables will be created when HgLab Installer finishes. These are created only after you sign in to HgLab web interface and complete HgLab Setup as described below.

Installing Mercurial

Mercurial is trivial to install. Download an MSI for Mercurial 3.6 or above from Mercurial Downloads (make sure that it matches your platform) and click through the installer.

Installing HgLab

Download HgLab Installer and follow prompts.

End-User License Agreement

The usual legalese you have to agree with to proceed with the installation.

Destination Folder

This is where HgLab will be installed. Please note that this is not where HgLab will be storing all its data, including repositories and logs.

Technical Aside On 32 and 64 Bits

HgLab is an ASP.NET application compiled as AnyCPU and actually runs as 64-bit process on 64-bit systems. The reason it installs to 32-bit Program Files directory is Windows Installer: there is no way of having a single MSI file to target both 32 and 64-bit systems, and having two separate versions of installer will complicate things.

Connection String

When setting a Connection String, stick to the following pattern:

data source={DATA-SOURCE};initial catalog={INITIAL-CATALOG};user id={USER-ID};password={PASSWORD}
  • DATA-SOURCE is the hostname (or the IP address) of the machine Microsoft SQL Server is running on. (local) or . is used in case SQL Server is running on the same server with HgLab. Additionally, if you are running an Express version, you will need to specify Instance Name, which is separated by the backslash. Typical instance name for Express versions is SQLEXPRESS, so DATA-SOURCE for the Microsoft SQL Server Express running on the local machine will most likely be (local)\SQLEXPRESS.
  • {INITIAL-CATALOG} is the name of the database created earlier.
  • {USER-ID} and {PASSWORD} are the login and password, respectively, created earlier.

Refer to for more information on how to construct a connection string.

HgLab Installer will not continue until it successfully connects using the Connection String provided.

Here are the important things it verifies:

  • Integrated Authentication is not used
  • Database can be connected to using supplied credentials
  • You are running Microsoft SQL Server 2008 at the minimum
  • User is a member of db_datareader, db_datawriter and db_ddladmin database roles

Home Directory

In addition to specifying the traditional Installation Directory, you'll also need to set HgLab Home Directory. This will be the location where HgLab will be keeping all the repositories, logs and other resources. Since HgLab does a lot of intensive disk I/O as part of its normal operation, it is advised to have the HgLab Home Directory on a reasonably fast device - ideally, on a SAS or an SSD disk.

Hg Executable Path

Installing HgLab 1.10 and Later

Starting from HgLab 1.10, Mercurial 3.6 or later is required to be present on the server where HgLab is being installed to.

Web Server Configuration

This is where you decide how you would like to be accessing HgLab. Options are:

  • Install HgLab as a new web site, which means that it will be hosted at a domain (i.e.
  • Install HgLab as a web application, meaning that it will be accessible in a "subdirectory" of an already existing domain (i.e.

Either option is perfectly valid and HgLab supports both configurations equally well. Deciding on which option to pick is a matter of preference and infrastructure requirements.

After all this, it's just a matter of clicking "Next" and let the setup complete the installation.

Setting Up HgLab

When you first open up HgLab in your web browser, you will be greeted with a HgLab Setup page. Remember to get here first, because this is where the very first System Administrator user is created.

Accessing HgLab Administration Area

Upon completing HgLab Setup, you will then need to provide a License. You can get a full-featured 45-day Evaluation License or purchase a perpetual license.

And now you're all set.

comments powered by Disqus

Take HgLab for a Spin

Try HgLab now. Full-featured 45-day evaluation, no credit card required.