AMT Help Files

Blazor WebAPI Appsettings

Regarding "AmtCookieEncryptionKey"
It is necessary for the "AmtCookieEncryptionKey" key to match the encryption key set for the AMT Application Center in its appsettings.json file.

This page lists the settings in the appsettings.json file for the ClientBlazor WebAPI. The file is located in the following directory: ..\<AMT root>\Apps\<Application>\ClientBlazor\WebApi\.

 
Note: the appsettings.json file name is case sensitive and must be lowercased.

The appsettings.json file is divided into the following sections.

Section Description
Amt The main section where most settings are located.
BlazorAPI Contains the settings used to connect to an application server or manager, or to a transaction server.
StartupParameters Optional section used to enable startup parameters.
Logging Contains the logging settings for the web application.
AllowedHosts A setting that restricts the hosts that may access the web application.
{
  "Amt": {
    "Authentication": {
        },
      }
    }
  },
  "BlazorAPI": {
  },
  },
    }
  },
}

AmtCookieEncryptionKey

This setting is explained in Generating Keys.

ApplicationName

The name of the Web Application. Normally there is no need to change the default value.

"ApplicationName": "BlazorWebAPI",

AuthenticationType

The authentication type used to validate tokens received from the Blazor WebClients, the only valid option is "JWT" (JSON Web Token).

"AuthenticationType": "JWT",

JWT

The 'JWT' section contains settings needed to validate tokens received from Blazor WebClients.

"JWT": {
  "Authority": "https://login.example.org/amt-applications/v2/auth",
  "Audience": "amt-blazor-webapi",
  "TokenValidationParameters": {
    "NameClaimType": "preferred_username"
  },
  "RequireHttpsMetadata": true
}

ConnectionType

The type of AMT service to which the Blazor WebAPI should connect.

For AMT Lion applications this should be set to either "AppServer" or to "AppManager" if an application manager is used.
In the case of an AMT Cobol application, the type should be "TransactionServer".
Finally AMT for CSharp applications should set the type to "VsWebApi".

"ConnectionType": "AppManager",

ConnectionAddress

The address of the AMT service to which the Blazor WebAPI should connect.
The syntax depends on the ConnectionType settings (see above).

ConnectionType: Syntax: Description:
AppServer /
AppManager
"<host>" Replace <host> with the address of the application manager/server. If not set, machine name will be used.
TransactionServer "GRPC:<address>:<port>" Replace <address> and <port> with the Transaction Server settings as set in the Control Center.
VsWebApi "<address>/api/" Replace <address> with the Business Logic web address of the application as set in the Control Center.
"ConnectionAddress": "<host>",

ConnectionPort

The port of the AMT service to which the Blazor WebAPI should connect.

Only required when a AppServer or AppManager is used as ConnectionType, i.e. AMT Lion applications.

"ConnectionPort": <port>,

EnableLogging

When enabled, the WebAPI will log debug information / exceptions to logs located in the folder .\App_Data\Logs\<date> inside the WebApi folder.

"EnableLogging": true,

SpareConnectionAddress

Optional: The address/hostname of a spare application manager to which the Blazor WebAPI should connect if the connection to the primary application manager fails. Only applicable if AppManager is used as ConnectionType.

"SpareConnectionAddress": "<host>",

SpareConnectionPort

Optional: The port of a spare application manager to which the Blazor WebAPI should connect if the connection to the primary application manager fails. Only applicable if AppManager is used as ConnectionType.

"SpareConnectionPort": <port>

StartupParameters

Optional section used to enable startup parameters and override their default values.
The allowed parameters are:

If enabled, startup parameters can be added to the URL of the web application as query string parameters.
They are appended with a question mark (?) and separated by ampersands (&).

Example:
https://amtweb.contoso.com/Customer_Management?Station=Station1&Sessiondata=Data1

"StartupParameters": {
   "Station": true,
   "Sessiondata": true
},

Logging

Sets the logging levels for the various ASP.NET Core components of the web application. These settings usually do not need to be adjusted.
The allowed log levels are, from most to least detailed: Trace, Debug, Information, Warning, Error, Critical, and None.

"Logging": {
  "LogLevel": {
    "Default": "Information",
    "Microsoft": "Warning",
    "Microsoft.Hosting.Lifetime": "Information",
    "System.Net.Http": "Warning"
  }
},

AllowedHosts

In the AllowedHosts section, access to the web application can be restricted to specific hostnames.
The value is a semicolon-delimited list of host names without port numbers.
By default, all hostnames are allowed by the asterisk (*) wildcard.
Disallowed users receive an HTTP 400 error code (Bad Request).

"AllowedHosts": "*"

Contents