This project is read-only.

Atlas configurations can be mixed allowing you to partially configure your service via the app.config and partially configure fluently.  Simply start configuring your host with the UseAppConfig configuration and then apply any fluent configurations after.

A simple example:

    <section name="atlas" type="Atlas.Configuration.XmlConfiguration, Atlas" />
    <host name="MyService" displayName="My Serivce Display Name" description="A Description of this service" allowMultipleInstances="true">
        <dependency name="MSMQ" />
      <runtime accounttype="networkservice" startup="automatic" username="myusername" password="mypassword" />
class Program
    static void Main(string[] args)
	var configuration = Host.UseAppConfig<MyService>()
		.BeforeStart(() => LogManager.Configure("MyLogger"))

In this example the dependency on MSSQLSERVER has been added in the fluent configuration.  This service will be dependent on both MSSQLSERVER and MSMQ.

Also, by passing in the command line args to Atlas in configuration will override the runtime configurations made in the app.config. It is recommended to use the command line arguments for installing and/or running your service in production environments so you can override the plain text runtime configuration values.

Using the exact same configuration above we can debug, install/run in test environments, and install/run in prod environments easily and consistently.

When debugging this service in Visual Studio

Open the .csproj Project Properties, add /console to the command line arguments on the Debug Tab, then press F5


MyCoolService.exe /console
When installing/running this service in QA or Test environments
MyCoolService.exe /install /start

or if you prefer

MyCoolService.exe /console
When we deploy and run this service in production
MyCoolService.exe /install /start /accounttype=user /username=MyCoolServiceAccount /password=MyProdPassword
note: passing in the production username and password via command line will override what exists in the app.config file.

Last edited May 1, 2011 at 4:49 PM by amiller, version 2


Rab815 Sep 29, 2015 at 9:26 PM 
When I try running this through Visual Studio in debug mode with /console in the properties of the debug tab, I receive a Cannot read keys when either application does not have a console or when console input has been redirected from a file. Try Console.Read. error? How can I resolve this?