本文整理汇总了C#中System.ServiceModel.Channels.Binding.CreateBindingElements方法的典型用法代码示例。如果您正苦于以下问题:C# Binding.CreateBindingElements方法的具体用法?C# Binding.CreateBindingElements怎么用?C# Binding.CreateBindingElements使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.ServiceModel.Channels.Binding
的用法示例。
在下文中一共展示了Binding.CreateBindingElements方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SafeCreateBindingElements
private static BindingElementCollection SafeCreateBindingElements(Binding binding)
{
if (binding == null)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("binding");
}
return binding.CreateBindingElements();
}
示例2: CustomBinding
// Binding passed to .ctor() seems to have nothing to do
// with the properties on this class.
public CustomBinding (Binding binding)
: this (binding.CreateBindingElements (),
binding.Name, binding.Namespace)
{
OpenTimeout = binding.OpenTimeout;
CloseTimeout = binding.CloseTimeout;
SendTimeout = binding.SendTimeout;
ReceiveTimeout = binding.ReceiveTimeout;
scheme = binding.Scheme;
security = binding as ISecurityCapabilities;
}
示例3: GetConfiguredSecurityStandardsManager
private SecurityStandardsManager GetConfiguredSecurityStandardsManager(Binding binding)
{
if (binding == null)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("binding");
}
SecurityBindingElement element = binding.CreateBindingElements().Find<SecurityBindingElement>();
if (element == null)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("binding", System.ServiceModel.SR.GetString("NoSecurityBindingElementFound"));
}
return new SecurityStandardsManager(element.MessageSecurityVersion, new WSSecurityTokenSerializer(element.MessageSecurityVersion.SecurityVersion));
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:13,代码来源:ServiceAuthenticationBehavior.cs
示例4: IsSecureConversationBinding
private bool IsSecureConversationBinding(Binding binding)
{
if (binding == null)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("binding");
}
SecurityBindingElement sbe = binding.CreateBindingElements().Find<SecurityBindingElement>();
if (sbe != null)
{
foreach (SecurityTokenParameters parameters in new System.ServiceModel.Security.SecurityTokenParametersEnumerable(sbe, true))
{
if (parameters is SecureConversationSecurityTokenParameters)
{
return true;
}
}
}
return false;
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:19,代码来源:ServiceAuthenticationBehavior.cs
示例5: IsTransactedReceive
internal static bool IsTransactedReceive(Binding binding, BindingParameterCollection bindingParameters)
{
// New school
ITransactedBindingElement transactedBindingElement = binding.GetProperty<ITransactedBindingElement>(bindingParameters);
if (transactedBindingElement != null)
{
return transactedBindingElement.TransactedReceiveEnabled;
}
// Old School
foreach (BindingElement element in binding.CreateBindingElements())
{
transactedBindingElement = element as ITransactedBindingElement;
if (transactedBindingElement != null && transactedBindingElement.TransactedReceiveEnabled)
{
return true;
}
}
return false;
}
示例6: IsManualAddressing
private bool IsManualAddressing(Binding binding)
{
TransportBindingElement transport = binding.CreateBindingElements().Find<TransportBindingElement>();
if (transport == null)
{
string text = SR.Format(SR.SFxBindingMustContainTransport2, binding.Name, binding.Namespace);
Exception error = new InvalidOperationException(text);
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(error);
}
return transport.ManualAddressing;
}
示例7: IsSecureConversationBinding
bool IsSecureConversationBinding(Binding binding)
{
if (binding == null)
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("binding");
SecurityBindingElement securityBindingElement = binding.CreateBindingElements().Find<SecurityBindingElement>();
if (securityBindingElement == null)
{
return false;
}
foreach (SecurityTokenParameters tokenParam in new SecurityTokenParametersEnumerable(securityBindingElement, true))
{
if (tokenParam is SecureConversationSecurityTokenParameters)
{
return true;
}
}
return false;
}
示例8: Extend
public CustomBinding Extend(Binding binding)
{
BindingElementCollection bindingElements = binding.CreateBindingElements();
return new CustomBinding(this.Extend(bindingElements));
}
示例9: IsManualAddressing
private bool IsManualAddressing(Binding binding)
{
TransportBindingElement element = binding.CreateBindingElements().Find<TransportBindingElement>();
if (element == null)
{
Exception exception = new InvalidOperationException(System.ServiceModel.SR.GetString("SFxBindingMustContainTransport2", new object[] { binding.Name, binding.Namespace }));
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(exception);
}
return element.ManualAddressing;
}
示例10: Initialize
private void Initialize(EndpointAddress address, Binding binding, ServiceCredentials credentials)
{
if (address == null)
throw new ArgumentNullException("address");
if (credentials == null)
throw new ArgumentNullException("credentials");
if (binding == null)
throw new ArgumentNullException("binding");
BindingElementCollection elements = binding.CreateBindingElements();
SslStreamSecurityBindingElement element = elements.Find<SslStreamSecurityBindingElement>();
if (element != null)
{
element.IdentityVerifier = new SWIdentityVerifier();
CustomBinding newbinding = new CustomBinding(elements);
// Transfer timeout settings from the old binding to the new
newbinding.CloseTimeout = binding.CloseTimeout;
newbinding.OpenTimeout = binding.OpenTimeout;
newbinding.ReceiveTimeout = binding.ReceiveTimeout;
newbinding.SendTimeout = binding.SendTimeout;
binding = newbinding;
}
_channelFactory = CreateChannelFactory(binding, address);
credentials.ApplyTo(_channelFactory);
CorrectChannelFactory();
}
示例11: GetIssuerBindingSecurityVersion
void GetIssuerBindingSecurityVersion(Binding issuerBinding, MessageSecurityVersion issuedTokenParametersDefaultMessageSecurityVersion, SecurityBindingElement outerSecurityBindingElement, out MessageSecurityVersion messageSecurityVersion, out SecurityTokenSerializer tokenSerializer)
{
// Logic for setting version is:
// 1. use issuer SBE
// 2. use ITSP
// 3. use outer SBE
//
messageSecurityVersion = null;
if (issuerBinding != null)
{
BindingElementCollection bindingElements = issuerBinding.CreateBindingElements();
SecurityBindingElement securityBindingElement = bindingElements.Find<SecurityBindingElement>();
if (securityBindingElement != null)
{
messageSecurityVersion = securityBindingElement.MessageSecurityVersion;
}
}
if (messageSecurityVersion == null)
{
if (issuedTokenParametersDefaultMessageSecurityVersion != null)
{
messageSecurityVersion = issuedTokenParametersDefaultMessageSecurityVersion;
}
else if (outerSecurityBindingElement != null)
{
messageSecurityVersion = outerSecurityBindingElement.MessageSecurityVersion;
}
}
if (messageSecurityVersion == null)
{
messageSecurityVersion = MessageSecurityVersion.Default;
}
tokenSerializer = this.CreateSecurityTokenSerializer(messageSecurityVersion.SecurityTokenVersion);
}
示例12: GetIssuerBindingKeyEntropyModeOrDefault
SecurityKeyEntropyMode GetIssuerBindingKeyEntropyModeOrDefault(Binding issuerBinding)
{
BindingElementCollection bindingElements = issuerBinding.CreateBindingElements();
SecurityBindingElement securityBindingElement = bindingElements.Find<SecurityBindingElement>();
if (securityBindingElement != null)
{
return securityBindingElement.KeyEntropyMode;
}
else
{
return parent.IssuedToken.DefaultKeyEntropyMode;
}
}
示例13: CreateBinding
static CustomBinding CreateBinding (Binding source)
{
var bec = source.CreateBindingElements ();
bec.Insert (0, new DiscoveryClientBindingElement ());
return new CustomBinding (bec);
}
示例14: GetIssuerBindingSecurityVersion
private void GetIssuerBindingSecurityVersion(Binding issuerBinding, MessageSecurityVersion issuedTokenParametersDefaultMessageSecurityVersion, SecurityBindingElement outerSecurityBindingElement, out MessageSecurityVersion messageSecurityVersion, out SecurityTokenSerializer tokenSerializer)
{
messageSecurityVersion = null;
if (issuerBinding != null)
{
SecurityBindingElement element = issuerBinding.CreateBindingElements().Find<SecurityBindingElement>();
if (element != null)
{
messageSecurityVersion = element.MessageSecurityVersion;
}
}
if (messageSecurityVersion == null)
{
if (issuedTokenParametersDefaultMessageSecurityVersion != null)
{
messageSecurityVersion = issuedTokenParametersDefaultMessageSecurityVersion;
}
else if (outerSecurityBindingElement != null)
{
messageSecurityVersion = outerSecurityBindingElement.MessageSecurityVersion;
}
}
if (messageSecurityVersion == null)
{
messageSecurityVersion = MessageSecurityVersion.Default;
}
tokenSerializer = this.CreateSecurityTokenSerializer(messageSecurityVersion.SecurityTokenVersion);
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:28,代码来源:ClientCredentialsSecurityTokenManager.cs
示例15: GetIssuerBindingKeyEntropyModeOrDefault
private SecurityKeyEntropyMode GetIssuerBindingKeyEntropyModeOrDefault(Binding issuerBinding)
{
SecurityBindingElement element = issuerBinding.CreateBindingElements().Find<SecurityBindingElement>();
if (element != null)
{
return element.KeyEntropyMode;
}
return this.parent.IssuedToken.DefaultKeyEntropyMode;
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:9,代码来源:ClientCredentialsSecurityTokenManager.cs