Skip to main content
Skip table of contents

Running as Windows service

Running a process as windows service is different from running it in an interactive windows session:

  • a different user might be used

  • network shares might need explicit authentication

  • no network drive mappings are available

We provide the possibility to mount and authenticate your network shares in a StartupScript.bat, see Using StartupScript.bat

The following actions require a command line window with local Administrator permissions.

Use built-in command-line options

Starting with v1.4.36 DpeNanoServices.exe supports built-in options for creating and deleting services.

Using the built-in options instead of sc.exe commands helps you avoiding typos and remembering the sc.exe syntax

Create windows service

  • Open command-line with Administrator privilges

  • Navigate to the folder containing the DpeNanoServices.exe

  • Use the DpeNanoServices arguments that you would use for starting it when not running as a service and add the option /createservice (uses DpeNanoServices as service name) or /createservice=MyTest (specify the service name) to it

  • This will also set some additional service configuration options, e.g. set NETMAN as dependency or setting the start mode to Auto

  • Please use the interactive windows service dialog to change the service user.

Examples

CODE
DpeNanoServices /createservice
CODE
DpeNanoServices --urls http://+:8000 --environment Production /createservice
CODE
DpeNanoServices --urls http://+:8000 --environment Production /createservice=MyTest

Example Result

image-20251201-110029.png

Delete windows service

  • Open command-line with Administrator privilges

  • Navigate to the folder containing the DpeNanoServices.exe

  • Use the DpeNanoServices option /deleteservice (auto-detect the service name) or specify the name of the service to delete /deleteservice=MyTest

Examples

CODE
DpeNanoServices /deleteservice
CODE
DpeNanoServices /deleteservice=MyTest

Example Result

image-20251201-110147.png

Use sc.exe commands

Create windows service

  • Ensure that all Prerequisites are installed

  • Open a command line window and navigate to the folder where you copied DpeNanoServices to

  • Optionally adapt your configuration in the appsettings.json file

  • Register DpeNanoServices as windows service, e.g.

    POWERSHELL
    sc.exe create DpeNanoServices binPath= "\"C:\my-full-path-to-folder\DpeNanoServices.exe\" --environment Production --urls http://localhost:5000"
  • Alternatively you can do

    POWERSHELL
    sc.exe create DpeNanoServices binPath= "dotnet \"C:\my-full-path-to-folder\DpeNanoServices.dll\" --environment Production --urls http://localhost:5000"

Use standard windows service configuration dialog to configure a dedicated user account used to run DpeNanoServices

Delete windows service

POWERSHELL
sc.exe delete DpeNanoServices

Change windows service configuration

Change start type to “Automatic (Delayed)”

POWERSHELL
sc.exe config DpeNanoServices start= delayed-auto

Run the service under a dedicated user account

POWERSHELL
sc.exe config DpeNanoServices type= own obj= "domain\user" password= "password"

The account must have the “log in as service right”. The standard windows service configuration dialog handles a missing right automatically.

Alternatively you can grant the right from command-line

POWERSHELL
ntrights.exe +r SeServiceLogonRight -u "%DOMAIN%\%USER%"

Add dependency to NETMAN to windows service configuration

DPE Nano Services in an enterprise installation depend on network services. To ensure that services are started in the right order add the dependency NETMAN

CODE
sc.exe config DpeNanoServices depend= NETMAN

Query windows service configuration

POWERSHELL
sc.exe query DpeNanoServices
sc.exe qc DpeNanoServices

Setting Environment Variables for a Windows Service

Environment variables can be configured globally, for the complete system.

Environment variables for a windows service can also be configured using the windows registry:

image-20251128-114554.png

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.