예제 #1
0
        public ServiceHost()
        {
            var config = new LocalConfigHelper(Assembly.GetExecutingAssembly().Location, "  WCF Service");

            IP     = config.GetString(nameof(IP));
            Port   = config.GetInt(nameof(Port));
            DTPort = config.GetInt(nameof(DTPort));

            _uris = new[]
            {
                new Uri($"net.tcp://{IP}:{Port}/TradingService"),
                new Uri($"http://{IP}:{DTPort}/TradingService")
            };

            var timeOut = new TimeSpan(0, 1, 0);

            _netTcpBinding = new NetTcpBinding
            {
                TransactionFlow        = false,
                ReceiveTimeout         = timeOut,
                SendTimeout            = timeOut,
                OpenTimeout            = timeOut,
                CloseTimeout           = timeOut,
                Security               = { Mode = SecurityMode.None },
                MaxBufferSize          = int.MaxValue,
                MaxReceivedMessageSize = int.MaxValue,
                MaxBufferPoolSize      = 1073741823,
                MaxConnections         = 100
            };

            _netTcpBinding.Security.Transport.ProtectionLevel      = System.Net.Security.ProtectionLevel.EncryptAndSign;
            _netTcpBinding.Security.Transport.ClientCredentialType = TcpClientCredentialType.Windows;
            _netTcpBinding.ReliableSession.InactivityTimeout       = timeOut;
        }
예제 #2
0
        public ServiceHost()
        {
            var config = new LocalConfigHelper(Assembly.GetExecutingAssembly().Location, " WebSocket Service");

            IP   = config.GetString(nameof(IP));
            Port = config.GetInt(nameof(Port));

            var core = new CoreServiceHost();

            _commandManager  = core.CommandManager;
            _webSocketServer = core.WebSocketServer;
            _core            = core;

            RegsterCommands();
        }