示例#1
0
        private static void StartThriftyServer(int port, string eurekaServer)
        {
            var factory = new LoggerFactory();

            factory.AddConsole(LogLevel.Debug);
            var serverConfig = new ThriftyServerOptions
            {
                QueueTimeout          = TimeSpan.FromMinutes(1),
                TaskExpirationTimeout = TimeSpan.FromMinutes(1)
            };


            var bootStrap = new ThriftyBootstrap(new object[] { new ScribeTest() },
                                                 serverConfig, new InstanceDescription("SampleApp", "TestApp122", PublicAddress), factory);

            bootStrap
            .SslConfig(new SslConfig
            {
                CertFile         = "server.pfx",
                CertPassword     = "******",
                CertFileProvider = new EmbeddedFileProvider(typeof(Program).GetTypeInfo().Assembly)
            })
            .AddService(typeof(IScribe), "0.0.1")
            .EurekaConfig(!String.IsNullOrWhiteSpace(eurekaServer), new EurekaClientConfig {
                EurekaServerServiceUrls = eurekaServer
            })
            .Bind(PublicAddress, port)
            .StartAsync();

            ThriftSerializer s = new ThriftSerializer(ThriftSerializer.SerializeProtocol.Binary);
        }