Atlas can be configured completely using the app.config file.  You can also use a combination of app.config and fluent configurations.  See Mixing Configurations.

When using the app.config file some configuration settings are required, while others are optional.

Here is an example of a service configured completely via the app.config.

<configuration>
  <configSections>
    <section name="atlas" type="Atlas.Configuration.XmlConfiguration, Atlas" />
  </configSections>
  <atlas>
    <host name="MyService" displayName="My Serivce Display Name" description="A Description of this service" allowMultipleInstances="true">
      <dependencies>
        <dependency name="MSSQLSERVER" secondsToWait="35" />
        <dependency name="MSMQ" />
      </dependencies>
      <runtime accounttype="networkservice" startup="automatic" username="myusername" password="mypassword" />
    </host>
  </atlas>
</configuration>
class Program
{
    static void Main(string[] args)
    {
	var configuration = Host.UseAppConfig<MyService>()
		.BeforeStart(() => LogManager.Configure("MyLogger"));
    }	
}
  Section Attribute Description
Required host name The name of the service
Optional host displayName The friendly name displayed in the services.msc snap-in
Optional host description A brief description of the service, visible in the services.msc snap-in
Optional host allowMultipleInstances Setting this will allow multiple instances of your process to run.

Allowing multiple instances is off by default preventing 2 instances of your service from running.
       
Dependencies Section – Optional Tells Atlas that your service requires other service(s) to be installed and running.
Required dependency name If a dependency is specified in the dependencies section, this attribute is required.

Tells Atlas that your service requires another service to be installed and running.

If the service with this name is not installed, Atlas will throw a ServiceDependencyException.

If the service is not running, Atlas will attempt to start the service.  If the dependent service is not in running state within 15 seconds Atlas will throw a ServiceDependencyException.
Optional dependency secondsToWait The number of seconds Atlas will wait while attempting to start the dependent service.   The default is 15 seconds if this configuration is not specified.

If the dependent service is not in running state within the specified secondsToWait Atlas will throw a ServiceDependencyException.
       
Runtime Section – Optional Allows your service’s runtime to be configuration driven.

It is only recommended to use this section for development and/or testing purposes. Since the username and password will be stored in the app.config file in plain text.

For production use, provide Atlas the correct runtime information via command line arguments.

Encrypting runtime configurations is on the project roadmap.
Optional runtime accounttype The account type your service will run as.

Options are (not case sensitive):
LocalSystem (default if not provided)
LocalService
NetworkService
User
Optional runtime startup The startup mode your service will run under.

Options are (not case sensitive:
Manual (default if not provided)
Automatic
Disabled
Optional runtime username The user name which your service will run as.  This is ignored if LocalSystem is the account type.
Optional runtime password The password for the user in which your service will run as.  This is ignored if LocalSystem is the account type.

Last edited May 1, 2011 at 3:52 PM by amiller, version 4

Comments

No comments yet.