コード例 #1
0
        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);
        }
コード例 #2
0
ファイル: NodeHost.cs プロジェクト: chergey/mpapi
        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;
        }
コード例 #3
0
        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);
        }
コード例 #4
0
ファイル: ComputingTests.cs プロジェクト: UiPath/coreipc
 public override void Dispose()
 {
     ((IDisposable)_computingClient).Dispose();
     ((IpcProxy)_computingClient).CloseConnection();
     _computingHost.Dispose();
     base.Dispose();
 }
コード例 #5
0
        /// <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;
        }
コード例 #6
0
ファイル: Program.cs プロジェクト: ape-box/BishopTakeshi
 private static void CancelHandler(object sender, ConsoleCancelEventArgs e)
 {
     System.Console.WriteLine("Exiting ...");
     service.Dispose();
     System.Console.WriteLine("Service stopped!");
     System.Environment.Exit(0);
 }
コード例 #7
0
ファイル: SystemTests.cs プロジェクト: UiPath/coreipc
 public override void Dispose()
 {
     ((IDisposable)_systemClient).Dispose();
     ((IpcProxy)_systemClient).CloseConnection();
     _systemHost.Dispose();
     base.Dispose();
 }
コード例 #8
0
 public void Dispose()
 {
     ((IDisposable)_computingClient).Dispose();
     ((IDisposable)_systemClient).Dispose();
     ((IpcProxy)_computingClient).CloseConnection();
     ((IpcProxy)_systemClient).CloseConnection();
     _host.Dispose();
 }
コード例 #9
0
    private static void Main(string[] args)
    {
        var host = new ServiceHost();

        using (LogService log = new LogService(host))
        {
            host.Dispose();
        }
    }
コード例 #10
0
        public void Dispose()
        {
            if (_host != null)
            {
                _host.Dispose();
            }

            _registrationServer.Dispose();
        }
コード例 #11
0
ファイル: ChannelTests.cs プロジェクト: OpenSharp/NDceRpc
        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();
        }
コード例 #12
0
ファイル: ChannelTests.cs プロジェクト: pombredanne/NDceRpc
        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();
        }
コード例 #13
0
ファイル: ChannelTests.cs プロジェクト: pombredanne/NDceRpc
        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();
        }
コード例 #14
0
ファイル: ChannelTests.cs プロジェクト: pombredanne/NDceRpc
        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();
        }
コード例 #15
0
ファイル: ChannelTests.cs プロジェクト: pombredanne/NDceRpc
        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();
        }
コード例 #16
0
ファイル: ChannelTests.cs プロジェクト: pombredanne/NDceRpc
        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();
        }
コード例 #17
0
ファイル: ChannelTests.cs プロジェクト: pombredanne/NDceRpc
        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();
        }
コード例 #18
0
ファイル: ChannelTests.cs プロジェクト: OpenSharp/NDceRpc
        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();
        }
コード例 #19
0
ファイル: ChannelTests.cs プロジェクト: OpenSharp/NDceRpc
        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();
        }
コード例 #20
0
ファイル: ChannelTests.cs プロジェクト: OpenSharp/NDceRpc
        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();
        }
コード例 #21
0
ファイル: ChannelTests.cs プロジェクト: OpenSharp/NDceRpc
        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();
        }
コード例 #22
0
 public void Close()
 {
    _host.Close();
    _host.Dispose();
 }
コード例 #23
0
 public void Dispose()
 {
     host.Dispose();
 }
コード例 #24
0
        public void Dispose()
        {
            _host?.Dispose();

            _registrationServer.Dispose();
        }
コード例 #25
0
ファイル: ChannelTests.cs プロジェクト: OpenSharp/NDceRpc
 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();
 }
コード例 #26
0
ファイル: ServiceThing.cs プロジェクト: TRUMPF-IoT/saf
 private void ShutdownService()
 {
     _serviceHost?.Dispose();
 }
コード例 #27
0
 public void TestFixtureTearDown()
 {
     _appHost.Container.Resolve <IDocumentStore>().Dispose();
     _appHost.Dispose();
 }