protected override IEnumerable <ServiceInstanceListener> CreateServiceInstanceListeners() { var l = HostExtensions.ToInstanceListener(ep => Configure(Host.CreateDefaultBuilder().ConfigureWebHostDefaults(webhost => Configure(webhost, ep).UseStartup <TStartup>().UseEndPoints(ep))), Context.NodeContext, Context.CodePackageActivationContext.GetEndpoint("GrpcEndpoint")); return(new ServiceInstanceListener[] { l }); }
public static ServiceInstanceListener HttpAspnetListener <TStartup>(this StatelessServiceContext serviceContext, string endpointName = "GrpcEndpoint") where TStartup : class { return(HostExtensions.ToInstanceListener(ep => Host.CreateDefaultBuilder() .ConfigureWebHostDefaults(webhost => webhost .UseKestrel(options => { options.Listen(IPAddress.Any, ep.Port, listenoptions => { listenoptions.Protocols = Microsoft.AspNetCore.Server.Kestrel.Core.HttpProtocols.Http2; }); options.AllowSynchronousIO = true; }) .UseStartup <TStartup>() .UseEndPoints(ep)), serviceContext.NodeContext, serviceContext.CodePackageActivationContext.GetEndpoint(endpointName))); }