本文整理汇总了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;
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}
示例6: ConfigureTransportProtectionAndAuthentication
internal static void ConfigureTransportProtectionAndAuthentication(HttpsTransportBindingElement https, HttpTransportSecurity transportSecurity)
{
ConfigureAuthentication(https, transportSecurity);
if (https.RequireClientCertificate)
{
transportSecurity.ClientCredentialType = HttpClientCredentialType.Certificate;
}
}
示例7: HttpBindingBase
internal HttpBindingBase()
{
_httpTransport = new HttpTransportBindingElement();
_httpsTransport = new HttpsTransportBindingElement();
_textEncoding = new TextMessageEncodingBindingElement();
_textEncoding.MessageVersion = MessageVersion.Soap11;
_httpsTransport.WebSocketSettings = _httpTransport.WebSocketSettings;
}
示例8: AddWindowsHttpsTransportBindingElement
private void AddWindowsHttpsTransportBindingElement(BindingElementCollection bindingElements)
{
HttpsTransportBindingElement item = new HttpsTransportBindingElement {
RequireClientCertificate = false,
UseDefaultWebProxy = false,
AuthenticationScheme = AuthenticationSchemes.Negotiate
};
bindingElements.Add(item);
}
示例9: CreateTransportBindingElement
private static HttpTransportBindingElement CreateTransportBindingElement(bool useTls){
if(useTls){
var transport = new HttpsTransportBindingElement();
transport.RequireClientCertificate = false;
return transport;
}else{
return new HttpTransportBindingElement();
}
}
示例10: Initialize
private void Initialize()
{
_securityBindingElement = CreateSecurityBindingElement();
_reliableSessionBindingElement = CreateReliableSessionBindingElement();
_mtomEncodingBindingElement = CreateMtomEncodingBindingElement();
_httpsTransportBindingElement = CreateHttpsTransportBindingElement() as HttpsTransportBindingElement;
}
示例11: EnableTransportSecurity
internal void EnableTransportSecurity(HttpsTransportBindingElement https)
{
if (this.mode == BasicHttpSecurityMode.TransportWithMessageCredential)
{
this.transportSecurity.ConfigureTransportProtectionOnly(https);
}
else
{
this.transportSecurity.ConfigureTransportProtectionAndAuthentication(https);
}
}
示例12: Initialize
private void Initialize()
{
_securityBindingElement = CreateSecurityBindingElement();
_reliableSessionBindingElement = CreateReliableSessionBindingElement();
_textEncodingBindingElement = CreateTextEncodingBindingElement();
_httpsTransportBindingElement = CreateHttpsTransportBindingElement();
//_httpTransportBindingElement = CreateHttpTransportBindingElement();
}
示例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;
}
示例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;
}
示例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);
}