Skip to content

Commit

Permalink
Merge pull request #164 from fiskaltrust/#128-Disable-grpc-warnings-o…
Browse files Browse the repository at this point in the history
…n-launcher-startup

#128 - Disable grpc warnings on launcher startup
  • Loading branch information
forsthug authored Jan 31, 2024
2 parents a61a5f6 + d68b672 commit b280c30
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public static LoggerConfiguration AddLoggingConfiguration(this LoggerConfigurati
.MinimumLevel.Override("Microsoft.AspNetCore.HttpLogging.HttpLoggingMiddleware", aspLogging ? LogEventLevel.Information : LogEventLevel.Warning)
.MinimumLevel.Override("System", LogEventLevel.Warning)
.MinimumLevel.Override("Grpc", LogEventLevel.Warning)
.MinimumLevel.Override("ProtoBuf", LogEventLevel.Warning);
.MinimumLevel.Override("ProtoBuf", LogEventLevel.Error);

return loggerConfiguration;
}
Expand Down
7 changes: 7 additions & 0 deletions src/fiskaltrust.Launcher/Services/HostingService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
using System.Runtime.Versioning;
using Microsoft.AspNetCore.Server.HttpSys;
using System.Text.Json;
using fiskaltrust.ifPOS.v0;

namespace fiskaltrust.Launcher.Services
{
Expand Down Expand Up @@ -249,6 +250,12 @@ private WebApplication CreateGrpcHost<T>(WebApplicationBuilder builder, Uri uri,
_logger.LogWarning($"{nameof(_launcherConfiguration.UseHttpSysBinding)} is not supported for grpc.");
}

ProtoBuf.Meta.RuntimeTypeModel.Default.Add(typeof(IAsyncResult), true);
ProtoBuf.Meta.RuntimeTypeModel.Default.Add(typeof(AsyncCallback), true);
ProtoBuf.Meta.RuntimeTypeModel.Default.Add(typeof(Stream), true);
ProtoBuf.Meta.RuntimeTypeModel.Default.GetSchema(typeof(IPOS));
ProtoBuf.Meta.RuntimeTypeModel.Default.Add(typeof(IPOS), true).AddSubType(1, typeof(ifPOS.v1.IPOS));

builder.WebHost.BindKestrel(uri, listenOptions => ConfigureTls(listenOptions), false, HttpProtocols.Http2);
builder.Services.AddCodeFirstGrpc(options => options.EnableDetailedErrors = true);
builder.Services.AddSingleton(instance);
Expand Down

0 comments on commit b280c30

Please sign in to comment.