Beispiel #1
0
        protected override IEnumerable <ServiceReplicaListener> CreateServiceReplicaListeners()
        {
            var l = HostExtensions.ToReplicaListener(ep =>
                                                     Configure(Host.CreateDefaultBuilder().ConfigureWebHostDefaults(webhost => Configure(webhost, ep).UseStartup <TStartup>().UseEndPoints(ep))), Context.NodeContext, Context.CodePackageActivationContext.GetEndpoint("GrpcEndpoint"));

            return(new ServiceReplicaListener[] { l });
        }
Beispiel #2
0
 public static ServiceReplicaListener HttpAspnetListener <TStartup>(this StatefulServiceContext serviceContext, string endpointName = "GrpcEndpoint") where TStartup : class
 {
     return(HostExtensions.ToReplicaListener(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)));
 }