Please enable JavaScript to view this site.

Navigation: » No topics above this level «

Kestrel Web Server

Scroll Prev Top Next More

 

 

 

Kestrel is a Microsoft multi-platform web server. Kestrel hosts ASP.NET Core web applications with all the necessary infrastructure to run. Linkar MANAGER and Linkar SERVER embed Kestrel process all inbound requests.

 

Inside the LinkarSuite folder is the Kestrel configuration parameters file, appsettings.json. Kestrel uses this for starting.

 

Windows: %ProgramData%\KOSDAY\LinkarSuite\appsettings.json

Linux and macOS: /var/KOSDAY/LinkarSuite/appsettings.json

 

This file is originally empty and Kestrel starts with default values. The Kestrel web server functionality can be customized to your preferences, by specifying parameters in this file. Start with a "Kestrel" node in appsettings.json as seen below. More information is available at https://docs.microsoft.com/en-us/aspnet/core/fundamentals/servers/kestrel?view=aspnetcore-5.0#kestrel-options

 

 

HTTP/2 is available in ASP NET Core 5 apps, you can find more information at https://docs.microsoft.com/en-us/aspnet/core/fundamentals/servers/kestrel/http2?view=aspnetcore-5.0

 

 

Please note: Kosday Support cannot diagnose issues with Kestrel customized configurations.
Please use available resources including Microsoft documentation, a preferred search engine, GitHub, StackExchange (and related Q&A sites) forums, blogs, and tools for JSON formatting and validation.

 

Logging

 

.NET Core supports a logging API that works with a variety of built-in and third-party logging providers. With Linkar Suite, this API can be used to log Kestrel information in a file. By default, Linkar does not generate any log for Kestrel activity. But logging data may be helpful to determine transaction volume, to identify client origination, and to improve security.

 

Linkar Suite uses the “Serilog-Sinks-File” provider/package to generate the log file. To prepare for logging, add a new “Serilog” section to appsettings.json.

 

{

  "Serilog": {

    "WriteTo": [

      {

        "Name": "File",

        "Args": {

          "path": "%PROGRAMDATA%\\KOSDAY\\LinkarSuite\\LOGS\\kestrel.log",

          "outputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level:u3}]{Message:lj}{NewLine}{Exception}",

          "fileSizeLimitBytes": "107374",

          "rollingInterval": "Day",

          "rollOnFileSizeLimit": "true",

          "retainedFileCountLimit": "31",

          "restrictedToMinimumLevel": "Error"

        }

      }

    ]

  },

 

  "Kestrel": {

  }

}

 

 

These are useful properties for the node Serilog > WriteTo > Args :

path

The path and file name "base" where log details will be written. A complete, not relative, file path is required for use with Linkar, using double “escaped” slashes. You also can use environment variables like %PROGRAMADATA%.

outputTemplate

Format for plain text log output.

fileSizeLimitBytes

File size limit for the log file. “Null” value means unlimited. It is recommended to limit the size, because some logs can be very large.

rollingInterval

Used to create a log file per day or another rolling time period (Year, Month, Day, Hour, Minute, Infinite)

rollOnFileSizeLimit

Create new log files every time the size of the file is reached.

retainedFileCountLimit

Maximum number of log files to keep. Used effectively with rolling specs.

restrictedToMinimumLevel

The minimum event level to log. See log levels below. Events with this level or higher will be logged.

See Serilog wiki for details and other options.

 

The Serilog > LogLevel node specifies the kind of detail that gets logged.

 

Other properties like LogCategory can be specified. See this Kestrel page on logging for details.

 

 

Important : Kestrel EndPoints

 

The schema for appsettings.json, as defined by Microsoft, includes an EndPoints node. Linkar does not use the EndPoints node in appsettings.json. Linkar uses config.xml file values, as configured through Linkar MANAGER.

 

 

IIS and Apache

 

Kestrel itself is a web server with minimal core functionality. Extended functionality around any such core is provided by larger web server packages. See the Kosday blog to configure Internet Information Server and Apache for use with Linkar and Kestrel.