Esempio n. 1
0
        static void Main()
        {
            var serverPublicPrivateKeys =
                new X509Certificate(@"C:\Users\node\Desktop\scs\SSLSamples\CertificateFiles\Server\privateKey.pfx",
                                    "123456789");
            //Create a Scs Service application that runs on 10048 TCP port.
            // var server = ScsServiceBuilder.CreateService(new ScsTcpEndPoint(10048));
            var server = SslScsServiceBuilder.CreateSslService(new ScsTcpEndPoint(10048)
                                                               , serverPublicPrivateKeys
                                                               , null
                                                               , SslScsAuthMode.ServerAuth);

            //Add Phone Book Service to service application
            server.AddService <IPhoneBookService, PhoneBookService>(new PhoneBookService());

            //Start server
            server.Start();

            //Wait user to stop server by pressing Enter
            Console.WriteLine("Phone Book Server started successfully. Press enter to stop...");
            Console.ReadLine();

            //Stop server
            server.Stop();
        }
Esempio n. 2
0
        static void Main()
        {
            //Create a service application that runs on 10083 TCP port
            //var serviceApplication = ScsServiceBuilder.CreateService(new ScsTcpEndPoint(10083));
            var serviceApplication = SslScsServiceBuilder.CreateSslService(new ScsTcpEndPoint(10083), Consts.ServerPublicPrivateKey, null, SslScsAuthMode.ServerAuth);

            //Create a CalculatorService and add it to service application
            serviceApplication.AddService <ICalculatorService, CalculatorService>(new CalculatorService());

            //Start service application
            serviceApplication.Start();

            Console.WriteLine("Calculator service is started. Press enter to stop...");
            Console.ReadLine();

            //Stop service application
            serviceApplication.Stop();
        }
Esempio n. 3
0
        static void Main()
        {
            var serverPublicPrivateKeys =
                new X509Certificate(@"C:\Users\node\Desktop\scs\SSLSamples\CertificateFiles\Server\privateKey.pfx",
                                    "123456789");
            //Create a service application that runs on 10083 TCP port
            //var serviceApplication = ScsServiceBuilder.CreateService(new ScsTcpEndPoint(10083));
            var serviceApplication = SslScsServiceBuilder.CreateSslService(new ScsTcpEndPoint(10083)
                                                                           , serverPublicPrivateKeys
                                                                           , null,
                                                                           SslScsAuthMode.ServerAuth);

            //Create a CalculatorService and add it to service application
            serviceApplication.AddService <ICalculatorService, CalculatorService>(new CalculatorService());

            //Start service application
            serviceApplication.Start();

            Console.WriteLine("Calculator service is started. Press enter to stop...");
            Console.ReadLine();

            //Stop service application
            serviceApplication.Stop();
        }