当前位置: 首页>>代码示例>>C#>>正文


C# HttpsTransportBindingElement类代码示例

本文整理汇总了C#中HttpsTransportBindingElement的典型用法代码示例。如果您正苦于以下问题:C# HttpsTransportBindingElement类的具体用法?C# HttpsTransportBindingElement怎么用?C# HttpsTransportBindingElement使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


HttpsTransportBindingElement类属于命名空间,在下文中一共展示了HttpsTransportBindingElement类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetClient

        public static OmnitureWebServicePortTypeClient GetClient( string username, string secret, string endpoint )
        {
            var httpsTransportBindingElement = new HttpsTransportBindingElement
                                                   {
                                                       UseDefaultWebProxy = false,
                                                       MaxReceivedMessageSize = 2147483647
                                                   };

            var transportSecurityBindingElement = new TransportSecurityBindingElement();
            transportSecurityBindingElement.EndpointSupportingTokenParameters.SignedEncrypted.Add( new SecurityTokenParameters() );
            transportSecurityBindingElement.IncludeTimestamp = false;

            var customTextMessageBindingElement = new CustomTextMessageBindingElement { MessageVersion = MessageVersion.Soap11 };

            var bindingElements = new List<BindingElement>
                                  {
                                      transportSecurityBindingElement,
                                      customTextMessageBindingElement,
                                      httpsTransportBindingElement
                                  };

            Binding customBinding = new CustomBinding( bindingElements.ToArray() );
            var endpointAddress = new EndpointAddress( endpoint );
            var clientCredential = new ClientCredentials( new Info( username, secret ) );

            var omnitureWebServicePortTypeClient = new OmnitureWebServicePortTypeClient( customBinding, endpointAddress );
            omnitureWebServicePortTypeClient.Endpoint.Behaviors.Remove( typeof( System.ServiceModel.Description.ClientCredentials ) );
            omnitureWebServicePortTypeClient.Endpoint.Behaviors.Add( clientCredential );

            return omnitureWebServicePortTypeClient;
        }
开发者ID:Sn3b,项目名称:Omniture-API,代码行数:31,代码来源:ClientHelper.cs

示例2: TryImportWsspHttpsTokenAssertion

 public override bool TryImportWsspHttpsTokenAssertion(MetadataImporter importer, ICollection<XmlElement> assertions, HttpsTransportBindingElement httpsBinding)
 {
     XmlElement element;
     if (assertions == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("assertions");
     }
     if (this.TryImportWsspAssertion(assertions, "HttpsToken", out element))
     {
         bool flag = true;
         string attribute = element.GetAttribute("RequireClientCertificate");
         try
         {
             httpsBinding.RequireClientCertificate = XmlUtil.IsTrue(attribute);
         }
         catch (Exception exception)
         {
             if (Fx.IsFatal(exception))
             {
                 throw;
             }
             if (exception is NullReferenceException)
             {
                 throw;
             }
             importer.Errors.Add(new MetadataConversionError(System.ServiceModel.SR.GetString("UnsupportedBooleanAttribute", new object[] { "RequireClientCertificate", exception.Message }), false));
             flag = false;
         }
         return flag;
     }
     return false;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:32,代码来源:WSSecurityPolicy11.cs

示例3: GetPhasorDataServiceProxyClient

        public static PhasorDataServiceClient GetPhasorDataServiceProxyClient()
        {
            string baseServiceUrl = Application.Current.Resources["BaseServiceUrl"].ToString();
            EndpointAddress address = new EndpointAddress(baseServiceUrl + "Service/PhasorDataService.svc");
            CustomBinding binding;

            if (HtmlPage.Document.DocumentUri.Scheme.ToLower().StartsWith("https"))
            {
                HttpsTransportBindingElement httpsTransportBindingElement = new HttpsTransportBindingElement();
                httpsTransportBindingElement.MaxReceivedMessageSize = int.MaxValue;		// 65536 * 50;
                binding = new CustomBinding(
                                    new BinaryMessageEncodingBindingElement(),
                                    httpsTransportBindingElement
                                    );
            }
            else
            {
                HttpTransportBindingElement httpTransportBindingElement = new HttpTransportBindingElement();
                httpTransportBindingElement.MaxReceivedMessageSize = int.MaxValue;	// 65536 * 50;
                binding = new CustomBinding(
                                    new BinaryMessageEncodingBindingElement(),
                                    httpTransportBindingElement
                                    );
            }

            binding.CloseTimeout = new TimeSpan(0, 20, 0);
            binding.OpenTimeout = new TimeSpan(0, 20, 0);
            binding.ReceiveTimeout = new TimeSpan(0, 20, 0);
            binding.SendTimeout = new TimeSpan(0, 20, 0);

            return new PhasorDataServiceClient(binding, address);
        }
开发者ID:JiahuiGuo,项目名称:openPDC,代码行数:32,代码来源:ProxyClient.cs

示例4: CreateWsspHttpsTokenAssertion

        public override XmlElement CreateWsspHttpsTokenAssertion(MetadataExporter exporter, HttpsTransportBindingElement httpsBinding)
        {
            Fx.Assert(httpsBinding != null, "httpsBinding must not be null.");
            Fx.Assert(httpsBinding.AuthenticationScheme.IsSingleton(), "authenticationScheme must be a singleton value for security-mode TransportWithMessageCredential.");

            XmlElement result = CreateWsspAssertion(WSSecurityPolicy.HttpsTokenName);
            if (httpsBinding.RequireClientCertificate ||
                httpsBinding.AuthenticationScheme == AuthenticationSchemes.Basic ||
                httpsBinding.AuthenticationScheme == AuthenticationSchemes.Digest)
            {
                XmlElement policy = CreateWspPolicyWrapper(exporter);
                if (httpsBinding.RequireClientCertificate)
                {
                    policy.AppendChild(CreateWsspAssertion(WSSecurityPolicy.RequireClientCertificateName));
                }
                if (httpsBinding.AuthenticationScheme == AuthenticationSchemes.Basic)
                {
                    policy.AppendChild(CreateWsspAssertion(WSSecurityPolicy.HttpBasicAuthenticationName));
                }
                else if (httpsBinding.AuthenticationScheme == AuthenticationSchemes.Digest)
                {
                    policy.AppendChild(CreateWsspAssertion(WSSecurityPolicy.HttpDigestAuthenticationName));
                }
                result.AppendChild(policy);
            }
            return result;
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:27,代码来源:WSSecurityPolicy12.cs

示例5: ConfigureTransportProtectionAndAuthentication

        internal static void ConfigureTransportProtectionAndAuthentication(this HttpTransportSecurity httpTransportSecurity, HttpsTransportBindingElement httpsTransportBindingElement)
        {
            Debug.Assert(httpTransportSecurity != null, "httpTransportSecurity cannot be null");
            Debug.Assert(httpsTransportBindingElement != null, "httpsTransportBindingElement cannot be null");

            httpTransportSecurity.ConfigureAuthentication(httpsTransportBindingElement);
            httpsTransportBindingElement.RequireClientCertificate = httpTransportSecurity.ClientCredentialType == HttpClientCredentialType.Certificate;
        }
开发者ID:haoduotnt,项目名称:aspnetwebstack,代码行数:8,代码来源:HttpTransportSecurityExtensionMethods.cs

示例6: ConfigureTransportProtectionAndAuthentication

 internal static void ConfigureTransportProtectionAndAuthentication(HttpsTransportBindingElement https, HttpTransportSecurity transportSecurity)
 {
     ConfigureAuthentication(https, transportSecurity);
     if (https.RequireClientCertificate)
     {
         transportSecurity.ClientCredentialType = HttpClientCredentialType.Certificate;
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:8,代码来源:HttpTransportSecurity.cs

示例7: HttpBindingBase

        internal HttpBindingBase()
        {
            _httpTransport = new HttpTransportBindingElement();
            _httpsTransport = new HttpsTransportBindingElement();

            _textEncoding = new TextMessageEncodingBindingElement();
            _textEncoding.MessageVersion = MessageVersion.Soap11;
            _httpsTransport.WebSocketSettings = _httpTransport.WebSocketSettings;
        }
开发者ID:SoumikMukherjeeDOTNET,项目名称:wcf,代码行数:9,代码来源:HttpBindingBase.cs

示例8: AddWindowsHttpsTransportBindingElement

 private void AddWindowsHttpsTransportBindingElement(BindingElementCollection bindingElements)
 {
     HttpsTransportBindingElement item = new HttpsTransportBindingElement {
         RequireClientCertificate = false,
         UseDefaultWebProxy = false,
         AuthenticationScheme = AuthenticationSchemes.Negotiate
     };
     bindingElements.Add(item);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:9,代码来源:WindowsRequestReplyBinding.cs

示例9: CreateTransportBindingElement

		private static HttpTransportBindingElement CreateTransportBindingElement(bool useTls){
			if(useTls){
				var transport = new HttpsTransportBindingElement();
				transport.RequireClientCertificate = false;
				return transport;
			}else{
				return new HttpTransportBindingElement();
			}
		}
开发者ID:zzilla,项目名称:ONVIF-Device-Manager,代码行数:9,代码来源:OnvifFactory.cs

示例10: Initialize

        private void Initialize()
        {
            _securityBindingElement = CreateSecurityBindingElement();

            _reliableSessionBindingElement = CreateReliableSessionBindingElement();

            _mtomEncodingBindingElement = CreateMtomEncodingBindingElement();

            _httpsTransportBindingElement = CreateHttpsTransportBindingElement() as HttpsTransportBindingElement;
        }
开发者ID:gtkrug,项目名称:gfipm-ws-ms.net,代码行数:10,代码来源:WspCustomSecuredBinding.cs

示例11: EnableTransportSecurity

 internal void EnableTransportSecurity(HttpsTransportBindingElement https)
 {
     if (this.mode == BasicHttpSecurityMode.TransportWithMessageCredential)
     {
         this.transportSecurity.ConfigureTransportProtectionOnly(https);
     }
     else
     {
         this.transportSecurity.ConfigureTransportProtectionAndAuthentication(https);
     }
 }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:11,代码来源:BasicHttpSecurity.cs

示例12: Initialize

        private void Initialize()
        {
            _securityBindingElement = CreateSecurityBindingElement();

            _reliableSessionBindingElement = CreateReliableSessionBindingElement();

            _textEncodingBindingElement = CreateTextEncodingBindingElement();

            _httpsTransportBindingElement = CreateHttpsTransportBindingElement();

            //_httpTransportBindingElement = CreateHttpTransportBindingElement();
        }
开发者ID:gtkrug,项目名称:gfipm-ws-ms.net,代码行数:12,代码来源:AdsCustomSecuredBinding.cs

示例13: HttpBindingBase

        internal HttpBindingBase()
        {
            this.httpTransport = new HttpTransportBindingElement();
            this.httpsTransport = new HttpsTransportBindingElement();

            this.textEncoding = new TextMessageEncodingBindingElement();
            this.textEncoding.MessageVersion = MessageVersion.Soap11;
            this.mtomEncoding = new MtomMessageEncodingBindingElement();
            this.mtomEncoding.MessageVersion = MessageVersion.Soap11;

            this.httpsTransport.WebSocketSettings = this.httpTransport.WebSocketSettings;
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:12,代码来源:HttpBindingBase.cs

示例14: CreateHttpsTransportBindingElement

        private HttpsTransportBindingElement CreateHttpsTransportBindingElement()
        {
            HttpsTransportBindingElement transportBindingElement = new HttpsTransportBindingElement();

            // When set to true, the IIS Site application must have the SSL require certificate set
            transportBindingElement.RequireClientCertificate = false;

            transportBindingElement.MaxBufferSize = 524288;
            transportBindingElement.MaxReceivedMessageSize = 200000000;
            transportBindingElement.MaxBufferSize = 200000000;

            return transportBindingElement;
        }
开发者ID:gtkrug,项目名称:gfipm-ws-ms.net,代码行数:13,代码来源:IdpStsCustomSecuredBinding.cs

示例15: Initialize

 private void Initialize()
 {
     this.httpTransport = new HttpTransportBindingElement();
     this.httpsTransport = new HttpsTransportBindingElement();
     this.messageEncoding = WSMessageEncoding.Text;
     this.txFlow = GetDefaultTransactionFlowBindingElement();
     this.session = new System.ServiceModel.Channels.ReliableSessionBindingElement(true);
     this.textEncoding = new TextMessageEncodingBindingElement();
     this.textEncoding.MessageVersion = MessageVersion.Soap12WSAddressing10;
     this.mtomEncoding = new MtomMessageEncodingBindingElement();
     this.mtomEncoding.MessageVersion = MessageVersion.Soap12WSAddressing10;
     this.reliableSession = new OptionalReliableSession(this.session);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:13,代码来源:WSHttpBindingBase.cs


注:本文中的HttpsTransportBindingElement类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。