Пример #1
0
        public void RpcCallError()
        {
            RpcFactory           anRpcFactory = new RpcFactory(mySerializer);
            IRpcService <IHello> anRpcService = anRpcFactory.CreateSingleInstanceService <IHello>(new HelloService());
            IRpcClient <IHello>  anRpcClient  = anRpcFactory.CreateClient <IHello>();

            try
            {
                anRpcService.AttachDuplexInputChannel(myMessaging.CreateDuplexInputChannel(myChannelId));
                anRpcClient.AttachDuplexOutputChannel(myMessaging.CreateDuplexOutputChannel(myChannelId));


                IHello aServiceProxy = anRpcClient.Proxy;
                Assert.Throws <RpcException>(() => aServiceProxy.Fail());
            }
            finally
            {
                if (anRpcClient.IsDuplexOutputChannelAttached)
                {
                    anRpcClient.DetachDuplexOutputChannel();
                }

                if (anRpcService.IsDuplexInputChannelAttached)
                {
                    anRpcService.DetachDuplexInputChannel();
                }
            }
        }