예제 #1
0
        public void DisposedChannelFactory_call()
        {
            var address = @"net.pipe://127.0.0.1/" + Guid.NewGuid().ToString("N");
            var serv = new SimpleService();
            var b = new NetNamedPipeBinding();

            using (var host = new ServiceHost(serv, new Uri[] { new Uri(address), }))
            {
                host.AddServiceEndpoint(typeof(ISimpleService), b, address);
                host.Open();
                var f = new ChannelFactory<ISimpleService>(b);
                var c = f.CreateChannel(new EndpointAddress(address));
                using (f) { }
                c.Do();
            }
        }
예제 #2
0
        public void DisposedChannelFactory_call()
        {
            var address = @"net.pipe://127.0.0.1/" + Guid.NewGuid().ToString("N");
            var serv    = new SimpleService();
            var b       = new NetNamedPipeBinding();

            using (var host = new ServiceHost(serv, new Uri[] { new Uri(address), }))
            {
                host.AddServiceEndpoint(typeof(ISimpleService), b, address);
                host.Open();
                var f = new ChannelFactory <ISimpleService>(b);
                var c = f.CreateChannel(new EndpointAddress(address));
                using (f) { }
                c.Do();
            }
        }