Kestrun assembly

global namespace

public type description
[Flags] enum KestrunApiContext Specifies the API context in which a Kestrun route or schedule can be executed.
class KestrunRuntimeApiAttribute Attribute to specify runtime API context and notes for Kestrun routes or schedules.

Kestrun namespace

public type description
static class FixedTimeEquals Provides constant-time comparison methods to prevent timing attacks.
static class KestrunHostManager Provides management functionality for KestrunHost instances, including creation, retrieval, starting, stopping, and destruction.
static class KestrunRuntimeInfo Utility class to expose information about the runtime environment that Kestrun was built for, and to gate features by TFM and runtime.

Kestrun.Authentication namespace

public type description
class ApiKeyAuthenticationOptions Options for API key authentication, including header names, validation, and claims issuance.
class ApiKeyAuthHandler Handles API Key authentication for incoming HTTP requests.
enum ApiKeyChallengeFormat Specifies the format for API key authentication challenges.
record AuthenticationCodeSettings Represents the settings for authentication code, including language, code, extra imports, and references.
class AuthenticationRegistry Registry of authentication options keyed by (schema, type). Stores as base AuthenticationSchemeOptions, with typed helpers.
static class AuthOptionsHelper Helper class to retrieve authentication options from the DI container.
class BasicAuthenticationOptions Options for configuring Basic Authentication in Kestrun.
class BasicAuthHandler Handles Basic Authentication for HTTP requests.
interface IAuthenticationCommonOptions Defines common options for authentication, including code validation, claim issuance, and claim policy configuration.
interface IAuthHandler Defines common options for authentication, including code validation, claim issuance, and claim policy configuration.
interface IClaimsCommonOptions Defines common options for authentication, including code validation, claim issuance, and claim policy configuration.
class JwtAuthenticationOptions Provides options for JWT authentication, including claim policies and custom claim issuance.

Kestrun.Certificates namespace

public type description
static class CertificateManager Drop-in replacement for Pode’s certificate helpers, powered by Bouncy Castle.
record CsrResult Represents the result of creating a Certificate Signing Request (CSR), including the PEM-encoded CSR and the private key.

Kestrun.Claims namespace

public type description
class ClaimPolicyBuilder Builder for defining claim-based authorization policies.
class ClaimPolicyConfig A bag of named policies, each backed by a ClaimRule.
static class ClaimPolicyExtensions Extension methods for converting ClaimPolicyConfig into ASP.NET Core authorization setup.
class ClaimPolicyPostConfigurer Copies ClaimPolicyConfig into AuthorizationOptions after configuration.
record ClaimRule Represents one claim must equal rule.
static class KestrunClaimExtensions Provides extension methods for the KestrunClaim enum.
enum UserIdentityClaim Represents the set of claims supported by Kestrun for authentication and authorization purposes.

Kestrun.Client namespace

public type description
static class KrHttpClientFactory Factory methods to create HttpClient instances for different transport types.
class KrHttpClientOptions Extra options to shape HttpClient behavior.
static class KrHttpDownloads Helper methods for common HTTP download scenarios.

Kestrun.Health namespace

public type description
class DiskSpaceProbe Probe that reports free disk space for a target drive / mount point.
enum HealthEndpointContentType Supported response content types for the built-in health endpoint.
class HealthEndpointOptions Options controlling the built-in health endpoint exposed by KestrunHost.
record HealthProbeEntry Represents the result of a single probe execution.
record HealthReport Represents an aggregated health report produced by HealthProbeRunner.
static class HealthReportTextFormatter Produces a concise, human-readable text representation of a HealthReport. Intended for terminals, logs, or lightweight probes where structured formats (JSON/YAML/XML) are unnecessary.
record HealthSummary Summary counts of probe results grouped by ProbeStatus.
class HttpProbe A health probe that performs an HTTP GET request to a specified URL and interprets the JSON response according to the health probe contract.
interface IProbe Defines a health probe that can be checked asynchronously.
abstract class Probe Base class for health probes.
record ProbeResult Result of a health probe check.
enum ProbeStatus Health probe status enumeration.
static class ProbeStatusLabels Provides string constants for well-known probe statuses that dynamic scripts may return. These values are used when converting script outputs into ProbeResult statuses.
class ProcessProbe A health probe that runs an external process and interprets its output.

Kestrun.Hosting namespace

public type description
class KestrunHost Provides hosting and configuration for the Kestrun application, including service registration, middleware setup, and runspace pool management.
static class KestrunHostAuthnExtensions Provides extension methods for adding authentication schemes to the Kestrun host.
static class KestrunHostHealthExtensions Adds health-check specific helpers to KestrunHost.
static class KestrunHostMapExtensions Provides extension methods for mapping routes and handlers to the KestrunHost.
static class KestrunHostRazorExtensions Provides extension methods for adding PowerShell and Razor Pages to a KestrunHost.
static class KestrunHostScriptValidationExtensions Provides extension methods for validating C# scripts in the context of a KestrunHost.
static class KestrunHostSessionExtensions Provides extension methods for configuring session state and distributed cache in Kestrun.
static class KestrunHostSignalRExtensions Extension methods for KestrunHost to support SignalR real-time broadcasting.
static class KestrunHostStaticFilesExtensions Provides extension methods for configuring static file, default file, favicon, and file server middleware in KestrunHost.
static class KestrunHttpMiddlewareExtensions Provides extension methods for configuring common HTTP middleware in Kestrun.
static class KestrunSecurityMiddlewareExtensions Extension methods for adding security-related middleware to a KestrunHost.
class NoopHostLifetime Minimal IHostLifetime that performs no blocking operations. Useful for scenarios like testing where the host lifecycle is externally managed.

Kestrun.Hosting.Compression namespace

public type description
static class KestrunCompressionServiceCollectionExtensions Extension methods to add Kestrun compression services.
class KestrunResponseCompressionProvider A response compression provider that respects endpoint metadata to disable compression. Wraps the built-in ResponseCompressionProvider.

Kestrun.Hosting.Options namespace

public type description
class ExceptionOptions Options for configuring Kestrun-style exception handling middleware.
static class KestrelOptionsExtensions Provides extension methods for copying configuration between KestrelServerOptions instances.
class KestrunOptions Simple options class for configuring Kestrel server settings.
record LanguageOptions Base options for specifying script code and language settings.
class ListenerOptions Configuration for an individual Kestrel listener.
record MapRouteOptions Options for mapping a route, including pattern, HTTP verbs, script code, authorization, and metadata.
record OpenAPIMetadata Metadata for OpenAPI documentation related to the route.
class StatusCodeOptions Options for configuring status code pages middleware.

Kestrun.Jwt namespace

public type description
enum JwtAlgorithm Specifies supported JWT signing algorithms.
static class JwtAlgorithmExtensions Provides extension methods for the JwtAlgorithm enum.
class JwtBuilderResult Represents the result of building a JWT, including the token, key, builder, issue time, and expiration.
static class JwtInspector Provides methods for inspecting and extracting parameters from JWT tokens.
class JwtParameters Represents all parameters extracted from a JWT, including header fields, standard properties, and claims.
class JwtTokenBuilder Fluent utility to create any flavour of JWS/JWE in one line.

Kestrun.Languages namespace

public type description
record CsGlobals Provides global and local variable dictionaries and context for C# delegate execution.

Kestrun.Logging namespace

public type description
static class LoggerConfigurationExtensions Convenience extensions for hooking Serilog loggers into LoggerManager.
static class LoggerExtensions Sanitized Serilog extensions to strip control chars (including CR/LF) from any string property values before writing the log.
static class LoggerManager Manages a collection of named Serilog loggers and their configurations.

Kestrun.Logging.Data namespace

public type description
class ErrorRecordWrapper Wraps an ErrorRecord object to provide additional logging information.
class InvocationInfoWrapper Wraps the PowerShell InvocationInfo object and exposes its properties for logging purposes.

Kestrun.Logging.Enrichers namespace

public type description
class ErrorRecordEnricher Enriches Serilog log events with error record and invocation info from WrapperException.

Kestrun.Logging.Enrichers.Extensions namespace

public type description
static class ErrorRecordEnricherExtensions Provides extension methods for enriching Serilog logs with error record information.
static class ErrorRecordExtensions Provides extension methods for formatting error records and invocation info as tables.

Kestrun.Logging.Exceptions namespace

public type description
class WrapperException Represents an exception that wraps another exception and optionally an ErrorRecord.

Kestrun.Logging.Sinks namespace

public type description
class PowerShellSink A Serilog sink that formats log events and invokes a callback for PowerShell integration.

Kestrun.Logging.Sinks.Extensions namespace

public type description
static class PowerShellSinkExtensions Provides extension methods for configuring PowerShell sinks in Serilog logging.

Kestrun.Logging.Utils.Console namespace

public type description
class Padding Represents padding values for left and right sides, and provides methods to generate padding strings.
class Table Represents a console table for formatted output with optional grid and padding.

Kestrun.Logging.Utils.Console.Extensions namespace

public type description
static class TableExtensions Provides extension methods for the Table class.

Kestrun.Middleware namespace

public type description
class CommonAccessLogMiddleware ASP.NET Core middleware that emits Apache style common access log entries using Serilog.
class CommonAccessLogOptions Options controlling the behaviour of the CommonAccessLogMiddleware.
static class FaviconMiddlewareExtensions Provides extension methods for serving a favicon in ASP.NET Core applications.
class PowerShellRunspaceMiddleware Initializes a new instance of the PowerShellRunspaceMiddleware class.
static class PowerShellRunspaceMiddlewareExtensions Extension methods for adding PowerShell runspace middleware.
static class StatusCodePageExtensions Extension methods for adding status code pages middleware.

Kestrun.Models namespace

public type description
class ContentDispositionOptions Options for Content-Disposition header.
enum ContentDispositionType Specifies the type of Content-Disposition header to use in the HTTP response.
record KestrunContext Represents the context for a Kestrun request, including the request, response, HTTP context, and host.
class KestrunRequest Represents a request model for Kestrun, containing HTTP method, path, query, headers, body, authorization, cookies, and form data.
class KestrunResponse Represents an HTTP response in the Kestrun framework, providing methods to write various content types and manage headers, cookies, and status codes.

Kestrun.Razor namespace

public type description
static class PowerShellRazorPage Provides middleware for enabling PowerShell-backed Razor Pages, allowing execution of a sibling PowerShell script (.cshtml.ps1) for each Razor view (.cshtml).
class PwshKestrunModel Base PageModel that exposes whatever the sibling PowerShell script placed in HttpContext.Items["PageModel"].

Kestrun.Runtime namespace

public type description
static class EnvironmentHelper Helpers for determining the current environment name.
static class VariablesMap Helper class to map common request and server properties, as well as shared state variables, into a dictionary.

Kestrun.Scheduling namespace

public type description
record JobInfo Represents a scheduled task with its configuration and state.
record ScheduleReport Represents a report of scheduled jobs at a specific time. Contains the generation time and a list of job information. This is useful for monitoring and auditing scheduled tasks.
class SchedulerService Represents a service for managing scheduled tasks. Provides methods to schedule, cancel, pause, resume, and report on tasks. This service is designed to run within a Kestrun application context. It supports both C# and PowerShell jobs, allowing for flexible scheduling options.

Kestrun.Scripting namespace

public type description
class CompilationErrorException Exception thrown when C# script compilation fails. Contains detailed diagnostic information about compilation errors.
class KestrunRunspacePoolManager Manages a pool of PowerShell runspaces for efficient reuse and resource control.
static class LanguageRuntimeExtensions Extension methods for IApplicationBuilder to support language-based runtime configuration.
static class RouteHandlerBuilderLanguageExtensions Extension methods for RouteHandlerBuilder to support script language metadata.
enum ScriptLanguage Specifies the supported scripting languages for script execution.
class ScriptLanguageAttribute Attribute to specify the script language for a method or delegate.

Kestrun.SharedState namespace

public type description
static class SharedStateStore Thread‑safe, case‑insensitive global key/value store for reference‑type objects.

Kestrun.SignalR namespace

public type description
interface IConnectionTracker Tracks connected SignalR clients for the Kestrun hub.
class InMemoryConnectionTracker In-memory thread-safe implementation of IConnectionTracker.
interface IRealtimeBroadcaster Provides an interface for broadcasting real-time messages to connected SignalR clients.
class KestrunHub Default SignalR hub for Kestrun providing real-time communication capabilities. Clients can connect to this hub to receive log messages, events, and other real-time updates.
class RealtimeBroadcaster Default implementation of IRealtimeBroadcaster that broadcasts messages via SignalR.

Kestrun.Tasks namespace

public type description
class KestrunTask Represents a single-shot task execution with its current state and telemetry.
class KestrunTaskService Service to run ad-hoc Kestrun tasks in PowerShell, C#, or VB.NET, with status, result, and cancellation.
record KrTask Basic information about a task for listing purposes.
class ProgressiveKestrunTaskState Represents the progress state of a task.
enum TaskState Represents the lifecycle state of a KestrunTask.

Kestrun.TBuilder namespace

public type description
static class EndpointConventionBuilderLanguageExtensions Extension methods for IEndpointConventionBuilder to support script language metadata.
static class EndpointDisablingCompressionExtensions Extension methods for IEndpointConventionBuilder to support disabling compression metadata.

Kestrun.Utilities namespace

public type description
static class AssemblyAutoLoader Registers one or more folders that contain private assemblies and makes sure every DLL in those folders is available to PowerShell / scripts. Call PreloadAll once at startup (or from PowerShell) and forget about “could not load assembly …” errors.
static class BuildError Utilities for formatting PowerShell error streams into HTTP responses.
static class CcUtilities Provides utility methods for Kestrun.
static class HostingExtensions Provides extension methods for hosting Kestrun servers.
[Flags] enum HttpVerb Common HTTP verbs recognized by the framework.
static class HttpVerbExtensions Extension methods for the HttpVerb enum.
static class PowerShellModuleLocator Utility class to locate the Kestrun PowerShell module. It searches for the module in both development and production environments.
static class RateLimiterOptionsExtensions Provides extension methods for copying rate limiter options and policies.
class ReadOnlyDictionaryAdapter Adapts a non-generic IDictionary to a read-only dictionary with string keys and nullable object values.
static class SecureStringUtils Provides utility methods for working with SecureString and ReadOnlySpan<char>.
static class XmlHelper Helpers for converting arbitrary objects into XElement instances.

Kestrun.Utilities.Json namespace

public type description
static class PayloadSanitizer Utilities to sanitize arbitrary payloads (especially PowerShell objects) into JSON-friendly shapes for System.Text.Json/SignalR serialization without reference cycles.

Kestrun.Utilities.Yaml namespace

public type description
class BigIntegerTypeConverter YAML type converter for BigInteger
class BuilderUtils Utility class for building YAML serializers with common settings
class FlowStyleAllEmitter YAML emitter that forces all mappings and sequences to use flow style
class FlowStyleSequenceEmitter YAML emitter that forces sequences to use flow style
class IDictionaryTypeConverter YAML type converter for IDictionary types
class NullValueGraphVisitor YAML object graph visitor that omits null values
class PSObjectTypeConverter YAML type converter for PSObject types
[Flags] enum SerializationOptions Options for YAML serialization
class StringQuotingEmitter YAML emitter that quotes strings that might be misinterpreted as other types
static class YamlHelper Provides helper methods for serializing and deserializing YAML content, with special handling for PowerShell objects.
static class YamlLoader Utility class for loading and parsing YAML documents
static class YamlSerializerFactory Factory for creating YamlDotNet serializers with specified options
static class YamlTypeConverter Utility class for converting YAML nodes to appropriate .NET types

Table of contents