public void CallServiceReturningSession2TimesFor2Channels_sessionAreDifferentForDifferentChannels() { var address = @"net.pipe://127.0.0.1/1/test.test/test" + MethodBase.GetCurrentMethod().Name; var serv = new SessionService(); var host = new ServiceHost(serv, new Uri(address)); var b = new NetNamedPipeBinding(); host.AddServiceEndpoint(typeof(ISessionService), b, address); var f1 = new ChannelFactory<ISessionService>(b); var f2 = new ChannelFactory<ISessionService>(b); var client1 = f1.CreateChannel(new EndpointAddress(address)); var client2 = f2.CreateChannel(new EndpointAddress(address)); host.Open(); var session11 = client1.Call(); var session21 = client2.Call(); var session22 = client2.Call(); var session12 = client1.Call(); f1.Dispose(); f2.Dispose(); host.Dispose(); Assert.AreEqual(session11, session12); Assert.AreEqual(session21, session22); Assert.AreNotEqual(session11, session21); }
public void Dispose() { //stop all running nodes lock (_runningNodes) { var runningNodeNames = new List <string>(); foreach (var name in _runningNodes.Keys) { runningNodeNames.Add(name); } foreach (var nodeName in runningNodeNames) { StopNode(nodeName); } } //disconnect from the registration server if (_registrationServerProxy != null) { _registrationServerProxy.UnregisterHost(_id); ((IDisposable)_registrationServerProxy).Dispose(); } //kill the host _host?.Dispose(); _host = null; }
public void CallServiceReturningSession2TimesFor2Channels_sessionAreDifferentForDifferentChannels() { var address = @"net.pipe://127.0.0.1/1/test.test/test" + MethodBase.GetCurrentMethod().Name; var serv = new SessionService(); var host = new ServiceHost(serv, new Uri(address)); var b = new NetNamedPipeBinding(); host.AddServiceEndpoint(typeof(ISessionService), b, address); var f1 = new ChannelFactory <ISessionService>(b); var f2 = new ChannelFactory <ISessionService>(b); var client1 = f1.CreateChannel(new EndpointAddress(address)); var client2 = f2.CreateChannel(new EndpointAddress(address)); host.Open(); var session11 = client1.Call(); var session21 = client2.Call(); var session22 = client2.Call(); var session12 = client1.Call(); f1.Dispose(); f2.Dispose(); host.Dispose(); Assert.AreEqual(session11, session12); Assert.AreEqual(session21, session22); Assert.AreNotEqual(session11, session21); }
public override void Dispose() { ((IDisposable)_computingClient).Dispose(); ((IpcProxy)_computingClient).CloseConnection(); _computingHost.Dispose(); base.Dispose(); }
/// <summary> /// Disconnects from the registration server and closes all connections to other nodes. /// </summary> public void Dispose() { //kill the send buffer processing thread SendBufferThreadTerminate = true; //dispose remote nodes lock (_remoteNodes) { foreach (INode nodeProxy in _remoteNodes.Values) { ((IDisposable)nodeProxy).Dispose(); } _remoteNodes.Clear(); } //clear local workers lock (_localWorkers) { _localWorkers.Clear(); } //disconnect from the registration server if (_registrationServerProxy != null) { _registrationServerProxy.UnregisterNode(_id); ((IDisposable)_registrationServerProxy).Dispose(); } //kill the host if (_host != null) { _host.Dispose(); } _host = null; }
private static void CancelHandler(object sender, ConsoleCancelEventArgs e) { System.Console.WriteLine("Exiting ..."); service.Dispose(); System.Console.WriteLine("Service stopped!"); System.Environment.Exit(0); }
public override void Dispose() { ((IDisposable)_systemClient).Dispose(); ((IpcProxy)_systemClient).CloseConnection(); _systemHost.Dispose(); base.Dispose(); }
public void Dispose() { ((IDisposable)_computingClient).Dispose(); ((IDisposable)_systemClient).Dispose(); ((IpcProxy)_computingClient).CloseConnection(); ((IpcProxy)_systemClient).CloseConnection(); _host.Dispose(); }
private static void Main(string[] args) { var host = new ServiceHost(); using (LogService log = new LogService(host)) { host.Dispose(); } }
public void Dispose() { if (_host != null) { _host.Dispose(); } _registrationServer.Dispose(); }
public void InterfaceInheritance() { var address = @"ipc:///test" + MethodBase.GetCurrentMethod().Name; var serv = new InheritanceService(); var host = new ServiceHost(serv, new Uri(address)); var b = new LocalBinding(); host.AddServiceEndpoint(typeof(IInheritanceService), b, address); host.Open(); var f = new ChannelFactory<IInheritanceService>(b); var c = f.CreateChannel(new EndpointAddress(address)); c.Do(); c.DoBase(); host.Dispose(); }
public void LongLocalName() { var address = @"ipc:///1/test.test/testtestLongNameLongNameLongNameLongNameLongNameLongNameLongNameLongNameLongNamefd0286a60b9b4db18659-b715e5db5b3bd0286a6-0b9b-4db1-8659-b715e5db5b3b"; var serv = new Service(null); var host = new ServiceHost(serv, new Uri(address)); var b = new LocalBinding(); host.AddServiceEndpoint(typeof(IService), b, address); host.Open(); var f = new ChannelFactory <IService>(b); var c = f.CreateChannel(new EndpointAddress(address)); var result = c.DoWithParamsAndResult(":)", Guid.NewGuid()); Assert.AreEqual(2, result.d1); host.Dispose(); }
public void TpcIp() { var address = @"net.tcp://127.0.0.1:18080"; var serv = new Service(null); var host = new ServiceHost(serv, new Uri(address)); var b = new NetTcpBinding(); host.AddServiceEndpoint(typeof(IService), b, address); host.Open(); var f = new ChannelFactory <IService>(b); var c = f.CreateChannel(new EndpointAddress(address)); var result = c.DoWithParamsAndResult(":)", Guid.NewGuid()); Assert.AreEqual(2, result.d1); host.Dispose(); }
public void InvokenBlockingWithParams_resultObtained() { var address = @"net.pipe://127.0.0.1/1/test.test/test"; var serv = new Service(null); var host = new ServiceHost(serv, new Uri(address)); var b = new NetNamedPipeBinding(); host.AddServiceEndpoint(typeof(IService), b, address); host.Open(); var f = new ChannelFactory <IService>(b); var c = f.CreateChannel(new EndpointAddress(address)); var result = c.DoWithParamsAndResult(":)", Guid.NewGuid()); Assert.AreEqual(2, result.d1); host.Dispose(); }
public void InvokeOneWay_waitOnEvent_received() { var address = @"net.pipe://127.0.0.1/1/test.test/test"; var wait = new ManualResetEvent(false); var serv = new Service(wait); var host = new ServiceHost(serv, new Uri(address)); var b = new NetNamedPipeBinding(); host.AddServiceEndpoint(typeof(IService), b, address); var f = new ChannelFactory <IService>(b); var c = f.CreateChannel(new EndpointAddress(address)); host.Open(); c.DoOneWay(); wait.WaitOne(); host.Dispose(); }
public void InterfaceInheritance() { var address = @"ipc:///test" + MethodBase.GetCurrentMethod().Name; var serv = new InheritanceService(); var host = new ServiceHost(serv, new Uri(address)); var b = new LocalBinding(); host.AddServiceEndpoint(typeof(IInheritanceService), b, address); host.Open(); var f = new ChannelFactory <IInheritanceService>(b); var c = f.CreateChannel(new EndpointAddress(address)); c.Do(); c.DoBase(); host.Dispose(); }
public void InvokeOtherService() { var address = @"net.pipe://127.0.0.1/1/test.test/test" + MethodBase.GetCurrentMethod().Name; var otherAddress = @"net.pipe://127.0.0.1/1/test.test/other" + MethodBase.GetCurrentMethod().Name; var wait = new ManualResetEvent(false); var srv = new Service(null); var otherSrv = new OtherService(wait); var host = new ServiceHost(srv, new Uri(address)); var b = new NetNamedPipeBinding(); host.AddServiceEndpoint(typeof(IService), b, address); var otherHost = new ServiceHost(otherSrv, new Uri(address)); otherHost.AddServiceEndpoint(typeof(IOtherService), b, otherAddress); var f = new ChannelFactory <IService>(b); var c = f.CreateChannel(new EndpointAddress(address)); host.Open(); otherHost.Open(); c.CallOtherService(otherAddress); wait.WaitOne(); host.Dispose(); otherHost.Dispose(); }
public void InvokenBlockingWithParams_resultObtained() { var address = @"net.pipe://127.0.0.1/1/test.test/test"; var serv = new Service(null); var host = new ServiceHost(serv, new Uri(address)); var b = new NetNamedPipeBinding(); host.AddServiceEndpoint(typeof(IService), b, address); host.Open(); var f = new ChannelFactory<IService>(b); var c = f.CreateChannel(new EndpointAddress(address)); var result = c.DoWithParamsAndResult(":)", Guid.NewGuid()); Assert.AreEqual(2, result.d1); host.Dispose(); }
public void TpcIp() { var address = @"net.tcp://127.0.0.1:18080"; var serv = new Service(null); var host = new ServiceHost(serv, new Uri(address)); var b = new NetTcpBinding(); host.AddServiceEndpoint(typeof(IService), b, address); host.Open(); var f = new ChannelFactory<IService>(b); var c = f.CreateChannel(new EndpointAddress(address)); var result = c.DoWithParamsAndResult(":)", Guid.NewGuid()); Assert.AreEqual(2, result.d1); host.Dispose(); }
public void LongNamePipe() { var address = @"net.pipe://127.0.0.1/1/test.test/testtestLongNameLongNameLongNameLongNameLongNameLongNameLongNameLongNameLongNamefd0286a60b9b4db18659-b715e5db5b3bd0286a6-0b9b-4db1-8659-b715e5db5b3b"; var serv = new Service(null); var host = new ServiceHost(serv, new Uri(address)); var b = new NetNamedPipeBinding(); host.AddServiceEndpoint(typeof(IService), b, address); host.Open(); var f = new ChannelFactory<IService>(b); var c = f.CreateChannel(new EndpointAddress(address)); var result = c.DoWithParamsAndResult(":)", Guid.NewGuid()); Assert.AreEqual(2, result.d1); host.Dispose(); }
public void InvokeOtherService() { var address = @"net.pipe://127.0.0.1/1/test.test/test" + MethodBase.GetCurrentMethod().Name; var otherAddress = @"net.pipe://127.0.0.1/1/test.test/other" + MethodBase.GetCurrentMethod().Name; var wait = new ManualResetEvent(false); var srv = new Service(null); var otherSrv = new OtherService(wait); var host = new ServiceHost(srv, new Uri(address)); var b = new NetNamedPipeBinding(); host.AddServiceEndpoint(typeof(IService), b, address); var otherHost = new ServiceHost(otherSrv, new Uri(address)); otherHost.AddServiceEndpoint(typeof(IOtherService), b, otherAddress); var f = new ChannelFactory<IService>(b); var c = f.CreateChannel(new EndpointAddress(address)); host.Open(); otherHost.Open(); c.CallOtherService(otherAddress); wait.WaitOne(); host.Dispose(); otherHost.Dispose(); }
public void Close() { _host.Close(); _host.Dispose(); }
public void Dispose() { host.Dispose(); }
public void Dispose() { _host?.Dispose(); _registrationServer.Dispose(); }
public void InvokeOneWay_waitOnEvent_received() { var address = @"net.pipe://127.0.0.1/1/test.test/test"; var wait = new ManualResetEvent(false); var serv = new Service(wait); var host = new ServiceHost(serv, new Uri(address)); var b = new NetNamedPipeBinding(); host.AddServiceEndpoint(typeof(IService), b, address); var f = new ChannelFactory<IService>(b); var c = f.CreateChannel(new EndpointAddress(address)); host.Open(); c.DoOneWay(); wait.WaitOne(); host.Dispose(); }
private void ShutdownService() { _serviceHost?.Dispose(); }
public void TestFixtureTearDown() { _appHost.Container.Resolve <IDocumentStore>().Dispose(); _appHost.Dispose(); }