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(); }
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); } }