Requirements

  • Run PowerShell as an Administrator

  • Since v2.0.74.0, the majority of TurboPlayerService API’s require the TurboPlayerServiceLicense.dll be present

Prepare the Environment (If Necessary)

  • Download the complete TurboPlayerService software package

    • IMPORTANT: at the moment, the TurboPlayerService.deps.json, TurboPlayerService.runtimeconfig.json and runtimes/ should exist in the package in order to have it successfully running

Install .NET 6.0 Runtime

Visit https://dotnet.microsoft.com/en-us/download/dotnet/6.0/runtime?cid=getdotnetcore

Download the Hosting Bundle and install it.

Create the Windows Service

To create the Windows Service, use the native Windows Service Control Manager's (sc.exe) create command.

sc.exe create "$TurboPlayerServiceInstanceNameOfYourChoice" binpath="C:\Path\To\TurboPlayerService.exe"
# OUTPUT: [SC] CreateService SUCCESS
POWERSHELL

Check the result

After successfully creating the service, you can find it in the Windows Services, such as the following.

Configure the Windows Service

The service can be configured like all other typical Windows services via context menu and dialogs.

Start and Stop the Windows Service

The service can be started and stopped like all other typical Windows services.

Define the URLs to use

This part is not specific to TurboPlayer Service hosted in a Windows Service. It is also valid when TurboPlayer Service is hosted by other containers such as a PowerShell environment. However, it makes sense to keep it here to ease the installation of TurboPlayer Service hosted in a Windows Service.

By default, the TurboPlayer Service like all other standard .NET 6 Core web applications will listen on port 5000 if no URL and port definition given.

In general, there are several ways to define the Urls for a .NET 6 Core web applications. However, in the context of an application hosted in a Windows Service, there is just one recommended way as given in the following.

The recommended way is to define Urls in the appsettings.json file or in the DigaSystem registry under the subkey "TurboPlayerService". The easiest way is to do it in the appsettings.json file.

The Urls follows the standard pattern supported by all standard .NET 6 Core web applications. (The value provided can be one or more HTTP and HTTPS endpoints (HTTPS only if a default cert is available). Configure the value as a semicolon-separated list (for example, "Urls": "http://localhost:8000;http://localhost:8001").)

For only HTTP, it is recommended to use the "Urls"  in appsettings.json:

{
  "Urls": "http://*:11250"
}
JS

For both HTTP and HTTPS, it is recommended to use "Kestrel" in appsettings.json:

{
  "Kestrel": {
    "Endpoints": {
      "Http": {
        "Url": "http://*:11250"
      },
      "HttpsInlineCertFile": {
        "Url": "https://$FQDN:11251",
        "Certificate": {
          "Path": "C:\\Path\\To\\ValidCertificate.pfx",
          "Password": "$Password"
        }
      }
    }
  }
}
JS

N.B. The HTTPS URL will not work automatically without making the following HTTPS configuration. In fact, it will stop TurboPlayer Service from successfully starting.

There are many more different ways to configure HTTP URLs and HTTPS URLs. For the biggest possibility, please reference the documentation given by Microsoft at https://docs.microsoft.com/en-us/aspnet/core/fundamentals/servers/kestrel/endpoints?view=aspnetcore-6.0 .

(Worth mentioning, according to some comments on the Internet, when the key "Kestrel" is configured, the key "Urls" may not take effects.)

Verify the running TurboPlayer Service instance

API to check HTTP requests

  • {{tps_origin}}/ExampleHttpVersion

    • internal test endpoint, subject to change, may be removed at any time

API to check WS requests

Delete the Windows Service

To delete the Windows Service, use the native Windows Service Control Manager's (sc.exe) delete command.

sc.exe delete "$TurboPlayerServiceInstanceNameOfYourChoice"
# OUTPUT: [SC] DeleteService SUCCESS
POWERSHELL

Troubleshooting

Windows could not start the service on Local Computer

There could be many causes which lead the this issue.

  1. The first diagnose method is to start the TurboPlayerService as a CLI program and check the output. 

  2. The second diagnose method is to check the log file (for example, Log/TurboPlayerService.log) for possibly useful information.

In Windows PowerShell: The required library hostfxr.dll could not be found.

It could be the .NET 6 runtime is not installed, please try to install the .NET 6 runtime environment as given in the "Prepare the Environment" section.