🐛 Bug fixes

This commit is contained in:
2025-09-20 16:29:45 +08:00
parent 9e4a58a8a0
commit 3710169f8c
12 changed files with 29 additions and 237 deletions

View File

@@ -22,10 +22,11 @@ public static class KestrelConfiguration
options.Limits.MaxRequestBodySize = maxRequestBodySize;
// gRPC
options.ListenAnyIP(5001, listenOptions =>
var grpcPort = int.Parse(configuration.GetValue<string>("GRPC_PORT", "5001"));
options.ListenAnyIP(grpcPort, listenOptions =>
{
listenOptions.Protocols = HttpProtocols.Http2;
var selfSignedCert = _CreateSelfSignedCertificate();
listenOptions.UseHttps(selfSignedCert);
});
@@ -43,7 +44,7 @@ public static class KestrelConfiguration
return builder;
}
static X509Certificate2 _CreateSelfSignedCertificate()
{
using var rsa = RSA.Create(2048);
@@ -64,7 +65,7 @@ public static class KestrelConfiguration
var notAfter = notBefore.AddYears(1);
var certificate = certRequest.CreateSelfSigned(notBefore, notAfter);
// Export to PKCS#12 and load using X509CertificateLoader
var pfxBytes = certificate.Export(X509ContentType.Pfx);
return X509CertificateLoader.LoadPkcs12(pfxBytes, password: null);