當前位置: 首頁>>代碼示例>>C#>>正文


C# Channels.Binding類代碼示例

本文整理匯總了C#中System.ServiceModel.Channels.Binding的典型用法代碼示例。如果您正苦於以下問題:C# Binding類的具體用法?C# Binding怎麽用?C# Binding使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Binding類屬於System.ServiceModel.Channels命名空間,在下文中一共展示了Binding類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: InfocardInteractiveChannelInitializer

		public InfocardInteractiveChannelInitializer (
			ClientCredentials credentials,
			Binding binding)
		{
			this.binding = binding;
			this.credentials = credentials;
		}
開發者ID:nickchal,項目名稱:pash,代碼行數:7,代碼來源:InfocardInteractiveChannelInitializer.cs

示例2: OnApplyConfiguration

 protected override void OnApplyConfiguration(Binding binding)
 {
     base.OnApplyConfiguration(binding);
     BasicHttpBinding bpBinding = (BasicHttpBinding)binding;
     bpBinding.MessageEncoding = this.MessageEncoding;
     this.Security.ApplyConfiguration(bpBinding.Security);
 }
開發者ID:iskiselev,項目名稱:JSIL.NetFramework,代碼行數:7,代碼來源:BasicHttpBindingElement.cs

示例3: IssuedSecurityTokenParameters

		public IssuedSecurityTokenParameters (string tokenType,
			EndpointAddress issuerAddress, Binding issuerBinding)
		{
			token_type = tokenType;
			issuer_address = issuerAddress;
			binding = issuerBinding;
		}
開發者ID:calumjiao,項目名稱:Mono-Class-Libraries,代碼行數:7,代碼來源:IssuedSecurityTokenParameters.cs

示例4: CreateSqlDatabaseManagementChannel

 public static ISqlDatabaseManagement CreateSqlDatabaseManagementChannel(Binding binding, Uri remoteUri, X509Certificate2 cert, string requestSessionId)
 {
     WebChannelFactory<ISqlDatabaseManagement> factory = new WebChannelFactory<ISqlDatabaseManagement>(binding, remoteUri);
     factory.Endpoint.Behaviors.Add(new ClientOutputMessageInspector(requestSessionId));
     factory.Credentials.ClientCertificate.Certificate = cert;
     return factory.CreateChannel();
 }
開發者ID:nickchal,項目名稱:pash,代碼行數:7,代碼來源:SqlDatabaseManagementHelper.cs

示例5: GetCustomBinding

 //Used by live contacts channel and Solr search and RelatedItems
 public static CustomBinding GetCustomBinding(Binding source)
 {
     CustomBinding result = new CustomBinding(source);
     WebMessageEncodingBindingElement element = result.Elements.Find<WebMessageEncodingBindingElement>();
     element.ContentTypeMapper = new RawMapper();
     return result;
 }
開發者ID:Klaudit,項目名稱:inbox2_desktop,代碼行數:8,代碼來源:RawMapper.cs

示例6: OnApplyConfiguration

 protected override void OnApplyConfiguration(Binding binding)
 {
     base.OnApplyConfiguration(binding);
     MsmqIntegrationBinding miBinding = (MsmqIntegrationBinding) binding;
     miBinding.SerializationFormat = this.SerializationFormat;
     this.Security.ApplyConfiguration(miBinding.Security);
 }
開發者ID:iskiselev,項目名稱:JSIL.NetFramework,代碼行數:7,代碼來源:MsmqIntegrationBindingElement.cs

示例7: GetCredentialTypeForBinding

        public string GetCredentialTypeForBinding(Binding binding)
        {
            if (binding.Scheme.Equals("http", StringComparison.OrdinalIgnoreCase))
                return "Username";

            return "Certificate";
        }
開發者ID:nothrow,項目名稱:OrionSDK,代碼行數:7,代碼來源:SubscriptionServiceHost.cs

示例8: AnnouncementEndpoint

		public AnnouncementEndpoint (DiscoveryVersion discoveryVersion, Binding binding, EndpointAddress address)
			: base (null, binding, address)
		{
			if (discoveryVersion == null)
				throw new ArgumentNullException ("discoveryVersion");
			DiscoveryVersion = discoveryVersion;
		}
開發者ID:MichaelWalsh,項目名稱:mono,代碼行數:7,代碼來源:AnnouncementEndpoint.cs

示例9: CommunicationClient

        /// <summary>
        /// The constructor.
        /// </summary>
        /// <param name="binding">The binding.</param>
        /// <param name="endpointAddress">The endpoint address.</param>
        /// <param name="hostReconnectIntervalMilliseconds">The cache host reconnect interval, in milliseconds.</param>
        public CommunicationClient(Binding binding, EndpointAddress endpointAddress, int hostReconnectIntervalMilliseconds)
        {
            // Sanitize
            if (binding == null)
            {
                throw new ArgumentNullException("binding");
            }
            if (endpointAddress == null)
            {
                throw new ArgumentNullException("endpointAddress");
            }
            if (hostReconnectIntervalMilliseconds <= 0)
            {
                throw new ArgumentException("must be greater than 0", "hostReconnectIntervalMilliseconds");
            }

            // Initialize the channel factory with the binding and endpoint address
            _channelFactory = new ChannelFactory<IClientToCacheContract>(binding, endpointAddress);

            // Set the cache host reconnect interval
            _hostReconnectIntervalMilliseconds = hostReconnectIntervalMilliseconds;

            // Initialize WCF
            _proxy = _channelFactory.CreateChannel();
            _proxyComm = _proxy as ICommunicationObject;

            // Set connected before opening to avoid a race
            _isConnected = true;

            // Initialize and configure the reconnect timer to never fire
            _reconnectTimer = new Timer(ReconnectToServer, null, Timeout.Infinite, Timeout.Infinite);
        }
開發者ID:nategreenwood,項目名稱:dache,代碼行數:38,代碼來源:CommunicationClient.cs

示例10: GetClient

        private WSRegistryServicePortTypeClient GetClient(String username, String password, 
            String serverURL, Binding binding)
        {
            ServicePointManager.ServerCertificateValidationCallback = 
                new RemoteCertificateValidationCallback(
                    delegate(object sender, X509Certificate certificate, 
                    X509Chain chain, SslPolicyErrors policyErrors) { return true; });
            AuthenticationAdminPortTypeClient authenticationAdmin =
                new AuthenticationAdminPortTypeClient(binding, 
                    new EndpointAddress(serverURL + "AuthenticationAdmin"));
            using (new OperationContextScope(authenticationAdmin.InnerChannel))
            {
                if (!authenticationAdmin.login(username, password, "127.0.0.1"))
                {
                    throw new SecurityException("Failed to login to system.");
                }
                HttpResponseMessageProperty response = (HttpResponseMessageProperty) 
                    System.ServiceModel.OperationContext.Current.
                    IncomingMessageProperties[HttpResponseMessageProperty.Name];
                cookie = response.Headers[HttpResponseHeader.SetCookie];
            }

            return new WSRegistryServicePortTypeClient(binding, 
                    new EndpointAddress(serverURL + "WSRegistryService"));
        }
開發者ID:GayanM,項目名稱:product-greg,代碼行數:25,代碼來源:RegistryClient.cs

示例11: TryCreate

 internal static bool TryCreate(SecurityBindingElement sbe, TransportBindingElement transport, PrivacyNoticeBindingElement privacy, ReliableSessionBindingElement rsbe, TransactionFlowBindingElement tfbe, out Binding binding)
 {
     WSFederationHttpSecurityMode mode;
     WSFederationHttpSecurity security2;
     bool isReliableSession = rsbe != null;
     binding = null;
     HttpTransportSecurity transportSecurity = new HttpTransportSecurity();
     if (!WSFederationHttpBinding.GetSecurityModeFromTransport(transport, transportSecurity, out mode))
     {
         return false;
     }
     HttpsTransportBindingElement element = transport as HttpsTransportBindingElement;
     if (((element != null) && (element.MessageSecurityVersion != null)) && (element.MessageSecurityVersion.SecurityPolicyVersion != WS2007MessageSecurityVersion.SecurityPolicyVersion))
     {
         return false;
     }
     if (TryCreateSecurity(sbe, mode, transportSecurity, isReliableSession, out security2))
     {
         binding = new WS2007FederationHttpBinding(security2, privacy, isReliableSession);
     }
     if ((rsbe != null) && (rsbe.ReliableMessagingVersion != ReliableMessagingVersion.WSReliableMessaging11))
     {
         return false;
     }
     if ((tfbe != null) && (tfbe.TransactionProtocol != TransactionProtocol.WSAtomicTransaction11))
     {
         return false;
     }
     return (binding != null);
 }
開發者ID:pritesh-mandowara-sp,項目名稱:DecompliedDotNetLibraries,代碼行數:30,代碼來源:WS2007FederationHttpBinding.cs

示例12: GetTokenUIAsyncResult

 internal GetTokenUIAsyncResult(Binding binding, IClientChannel channel, ClientCredentials credentials, AsyncCallback callback, object state) : base(callback, state)
 {
     this.credentials = credentials;
     this.proxy = channel;
     this.binding = binding;
     this.CallBegin(true);
 }
開發者ID:pritesh-mandowara-sp,項目名稱:DecompliedDotNetLibraries,代碼行數:7,代碼來源:GetTokenUIAsyncResult.cs

示例13: InitializeFrom

 protected internal override void InitializeFrom(Binding binding)
 {
     base.InitializeFrom(binding);
     MsmqBindingBase base2 = (MsmqBindingBase) binding;
     this.DeadLetterQueue = base2.DeadLetterQueue;
     if (base2.CustomDeadLetterQueue != null)
     {
         this.CustomDeadLetterQueue = base2.CustomDeadLetterQueue;
     }
     this.Durable = base2.Durable;
     this.ExactlyOnce = base2.ExactlyOnce;
     this.MaxReceivedMessageSize = base2.MaxReceivedMessageSize;
     this.MaxRetryCycles = base2.MaxRetryCycles;
     if (!base2.ReceiveContextEnabled)
     {
         this.ReceiveContextEnabled = base2.ReceiveContextEnabled;
     }
     this.ReceiveErrorHandling = base2.ReceiveErrorHandling;
     this.ReceiveRetryCount = base2.ReceiveRetryCount;
     this.RetryCycleDelay = base2.RetryCycleDelay;
     this.TimeToLive = base2.TimeToLive;
     this.UseSourceJournal = base2.UseSourceJournal;
     this.UseMsmqTracing = base2.UseMsmqTracing;
     if (base2.ValidityDuration != MsmqDefaults.ValidityDuration)
     {
         this.ValidityDuration = base2.ValidityDuration;
     }
 }
開發者ID:pritesh-mandowara-sp,項目名稱:DecompliedDotNetLibraries,代碼行數:28,代碼來源:MsmqBindingElementBase.cs

示例14: TestDownloadStream

        static void TestDownloadStream(string address, Binding binding)
        {
            ChannelFactory<IHelloWorld> channelFactory = new ChannelFactory<IHelloWorld>(binding, address);
            ServicePointManager.ServerCertificateValidationCallback = (snder, cert, chain, error) => true;
            channelFactory.Credentials.UserName.UserName = "h";
            channelFactory.Credentials.UserName.Password = "p";
            IHelloWorld client = channelFactory.CreateChannel();
            ((IChannel)client).Open();

            Console.WriteLine("Invoking DownloadStream...");
            Stream stream = client.DownloadStream();

            int readResult;
            int bytesRead = 0;
            byte[] buffer = new byte[1000];
            do
            {
                readResult = stream.Read(buffer, 0, buffer.Length);
                bytesRead += readResult;
            }
            while (readResult != 0);

            stream.Close();

            Console.WriteLine("Read {0} bytes.", bytesRead);

            ((IChannel)client).Close();
        }
開發者ID:v-zhidu,項目名稱:WCFTraining,代碼行數:28,代碼來源:Program.cs

示例15: GetBindingForBinding

        public string GetBindingForBinding(Binding binding)
        {
            if (binding.Scheme.Equals("http", StringComparison.OrdinalIgnoreCase))
                return "Soap1_1";

            return "NetTcp";
        }
開發者ID:nothrow,項目名稱:OrionSDK,代碼行數:7,代碼來源:SubscriptionServiceHost.cs


注:本文中的System.ServiceModel.Channels.Binding類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。