Beispiel #1
0
        public Task StartAsync(CancellationToken cancellationToken)
        {
            return(Task.Factory.StartNew(() =>
            {
                var channelOptions = new List <ChannelOption>()
                {
                    new ChannelOption(ChannelOptions.MaxReceiveMessageLength, int.MaxValue),
                    new ChannelOption(ChannelOptions.MaxSendMessageLength, int.MaxValue)
                };

                _grpcServer = new Server(channelOptions)
                {
                    Services = { SchedulerService.BindService(_schedulerServiceBase), FileService.BindService(_fileServiceBase) },
                    Ports = { new ServerPort(_config.Host, _config.Port, ServerCredentials.Insecure) }
                };

                _grpcServer.Start();
            }, cancellationToken, TaskCreationOptions.LongRunning, TaskScheduler.Current));
        }