Class GrpcServer
- Namespace
- DMediatR
- Assembly
- DMediatR.dll
Utility for creating a gRPC service WebApplicationBuilder and WebApplication in a DMediatR node.
public static class GrpcServer
- Inheritance
-
GrpcServer
- Inherited Members
Properties
ConsoleTitle
For setting the Console.Title in Program.cs. Includes the optional ASPNETCORE_ENVIRONMENT, Host and Port.
public static string ConsoleTitle { get; }
Property Value
IntermediateCrt
The intermediate certificate client and server certificates are validated against.
public static X509Certificate2? IntermediateCrt { get; }
Property Value
IntermediateCrtOld
The old intermediate certificate client and server certificates were validated against. Used for certificate renewal
public static X509Certificate2? IntermediateCrtOld { get; }
Property Value
Logger
public static ILogger<X509Chain>? Logger { get; }
Property Value
Methods
CreateWebApp(WebApplicationBuilder, GrpcPort)
public static WebApplication CreateWebApp(WebApplicationBuilder builder, GrpcPort usePort = GrpcPort.UseDefault)
Parameters
builder
WebApplicationBuilderusePort
GrpcPort
Returns
CreateWebAppBuilder(string[], GrpcPort)
public static WebApplicationBuilder CreateWebAppBuilder(string[] args, GrpcPort usePort = GrpcPort.UseDefault)
Parameters
Returns
GetHostOptions(string)
Get the Host options outside of the WebApplicationBuilder.
public static HostOptions GetHostOptions(string environment = "")
Parameters
environment
string
Returns
LoadIntermediateCertificates(IServiceProvider)
Used only for validation, thus take the .crt file and ignore RenewBeforeExpirationDays.
public static void LoadIntermediateCertificates(IServiceProvider serviceProvider)
Parameters
serviceProvider
IServiceProvider
Exceptions
RunRestartWebAppAsync(string[], GrpcPort, Action<WebApplicationBuilder>?, CancellationToken)
Build and run the WebApplication, repeat after it was stopped with IHostApplicationLifetime.StopApplication().
public static Task RunRestartWebAppAsync(string[] args, GrpcPort usePort, Action<WebApplicationBuilder>? builderCfg, CancellationToken cancellationToken)
Parameters
args
string[]usePort
GrpcPortbuilderCfg
Action<WebApplicationBuilder>Optional callback for additional configuration of the WebApplicationBuilder, such as adding a concrete logger.
cancellationToken
CancellationToken
Returns
SetUpInitialCertificateChain(Action<ILoggingBuilder>)
Generate or renew the certificate chain by directly using the local services.
public static string SetUpInitialCertificateChain(Action<ILoggingBuilder> configureLogging)
Parameters
configureLogging
Action<ILoggingBuilder>
Returns
- string
FilePath where the certificate chain was saved.