public void SetUp() { _host = new ServiceHost(); _service = new TestService(); _host.AddService(_service); _host.StartServiceHost(); _host.OpenServices(); _invoker = new BlockingThreadInvoker(); }
private static void StartService() { ServiceHost host = new ServiceHost(); host.AddService(new HelloWorldService()); host.StartServiceHost(); host.OpenServices(); Console.WriteLine("Press enter to stop server"); Console.ReadLine(); host.CloseServices(); host.StopServiceHost(); }
public void SetUp() { _host = new ServiceHost(); _service = new RemotingTestService(); _host.AddService(_service); _host.StartServiceHost(); _host.OpenServices(); _invoker = new BlockingThreadInvoker(); IRemotingTestServices services = _service.GetServices(_invoker); _connection = _invoker.WaitOn(services.Connect()); }
public void TestQueue() { ServiceHost host = new ServiceHost(); InvokeQueueTestService testService = new InvokeQueueTestService(); host.AddService(testService); host.StartServiceHost(); host.OpenServices(); using (ManualResetEvent callbackEvent = new ManualResetEvent(false)) { object state = new object(); IAsyncResult resultFromCallback; object stateFromCallback; bool callbackWorked = false; IInvokeQueueTestInterface testInterface = testService.GetTestInterface(null); /* Hmm, blocking from deferreds is a bit tricky. Deferred<int> result = testInterface.GetReactorThreadId(false); int reactorThreadId = testService.EndGetReactorThreadId(result); Assert.AreNotEqual(Thread.CurrentThread.ManagedThreadId, reactorThreadId); Assert.AreNotEqual(0, reactorThreadId); */ bool callbackCompleted = callbackEvent.WaitOne(2000, false); Assert.IsTrue(callbackCompleted); Assert.IsTrue(callbackWorked); } host.StopServiceHost(); }
private static void StartChatRoomServer(ChatroomSettings settings) { ServiceHost host = new ServiceHost(); host.AddService(new ChatroomService(settings)); host.StartServiceHost(); host.OpenServices(); Console.WriteLine("Type \"quit\" to shut down server"); string input = null; do { input = Console.ReadLine(); Console.WriteLine(input); //TODO: Implement Console Commands } while (input != "quit"); host.CloseServices(); host.StopServiceHost(); }
protected override void OnServiceOpen(IServiceHost host) { _rebuilderService = new FileRebuilderService(Settings); _host = new ServiceHost(); _host.AddService(_rebuilderService); _host.StartServiceHost(); _host.OpenServices(); }
void _service_ServerConnectionFailed(object sender, EventArgs e) { if (ServerConnectionFailed != null) { _service = null; _host = null; ServerConnectionFailed(sender, e); } LoggedIn = false; }
internal void StartHost() { if (_service != null) return; _host = new ServiceHost(); _service = new ChatroomClientService(TermReceived); _service.ServerConnectionFailed += new EventHandler(_service_ServerConnectionFailed); _host.AddService(_service); _host.StartServiceHost(); _host.OpenServices(); _hostStarted = true; }
public ClientConsole() { _host = new ServiceHost(); _service = new MessageClientService(); }