コード例 #1
0
        private static IEnumerable <Hotel> GetHotels()
        {
            Uri serviceUri = new Uri("net.tcp://localhost:8000/lodging", UriKind.Absolute);

            ChannelFactory <ILodgingService> cf = new ChannelFactory <ILodgingService>(
                new NetTcpBinding(),
                new EndpointAddress(serviceUri)
                );

            ILodgingService ch = cf.CreateChannel();

            return(ch.GetHotels());
        }
コード例 #2
0
ファイル: HotelsViewModel.cs プロジェクト: AsishP/Azure
        private static IEnumerable <Hotel> GetHotels()
        {
            Uri serviceUri = null;

            ChannelFactory <ILodgingService> cf = new ChannelFactory <ILodgingService>(
                new NetTcpRelayBinding(),
                new EndpointAddress(serviceUri)
                );

            TransportClientEndpointBehavior endpointBehavior = new TransportClientEndpointBehavior();

            endpointBehavior.TokenProvider = TokenProvider.CreateSharedSecretTokenProvider("owner", "f0f/xIwKqxR0IqZHuzsVmLktTTReNOg93qjJ1KUr+kA=");
            cf.Endpoint.EndpointBehaviors.Add(endpointBehavior);

            ILodgingService ch = cf.CreateChannel();

            return(ch.GetHotels());
        }
コード例 #3
0
        private static IEnumerable <Hotel> GetHotelsFromRelay()
        {
            Uri serviceUri = ServiceBusEnvironment.CreateServiceUri("sb", "sb20532[Your Name]", "lodging");

            ChannelFactory <ILodgingService> cf = new ChannelFactory <ILodgingService>(
                new NetTcpRelayBinding(),
                new EndpointAddress(serviceUri)
                );

            TransportClientEndpointBehavior endpointBehavior = new TransportClientEndpointBehavior();

            endpointBehavior.TokenProvider = TokenProvider.CreateSharedAccessSignatureTokenProvider("RootManageSharedAccessKey", "<put your access key here>");
            cf.Endpoint.EndpointBehaviors.Add(endpointBehavior);

            ILodgingService ch = cf.CreateChannel();

            return(ch.GetHotels());
        }