-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
25 lines (19 loc) · 818 Bytes
/
Copy pathProgram.cs
File metadata and controls
25 lines (19 loc) · 818 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
using System.Net;
using net_grpc_letsencrypt.Services;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddGrpc();
builder.Services.AddLettuceEncrypt();
builder.WebHost.UseKestrel(options =>
{
var appServices = options.ApplicationServices;
options.Listen(IPAddress.Any, 80);
options.Listen(IPAddress.Any, 443, listenOptions =>
{
// kestrel has to encrypt/decrypt certificate directly, without proxying
listenOptions.UseHttps(h => h.UseLettuceEncrypt(appServices));
});
});
var app = builder.Build();
app.MapGrpcService<GreeterService>();
app.MapGet("/", () => "Communication with gRPC endpoints must be made through a gRPC client. To learn how to create a client, visit: https://go.microsoft.com/fwlink/?linkid=2086909");
app.Run();