示例#1
0
        private void InitializeServices()
        {
            if (_fileService != null && _fileService.State == CommunicationState.Opened)
            {
                _fileService.CloseService();
            }

            if (_testService != null && _testService.State == CommunicationState.Opened)
            {
                _testService.CloseService();
            }

            // Host the services
            _fileService = new FileServiceHost(9123, UploadsDirectory);
            _fileService.LaunchService();

            _testService = new TestServiceHost(9123, UploadsDirectory);
            _testService.LaunchService();
        }
示例#2
0
        static void Main(string[] args)
        {
            var fileServiceHost = new FileServiceHost(9123, @"C:\Uploads");

            fileServiceHost.LaunchService();

            Console.WriteLine("File Server Address: {0}", fileServiceHost.ServiceAddress);
            Console.WriteLine("File Server State: {0}", fileServiceHost.State);

            var testServiceHost = new TestServiceHost(9123, @"C:\Uploads");

            testServiceHost.LaunchService();

            Console.WriteLine("Test Server Address: {0}", testServiceHost.ServiceAddress);
            Console.WriteLine("Test Server State: {0}", testServiceHost.State);

            while (true)
            {
                Thread.Sleep(5000);
            }
        }