本文整理汇总了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;
}
示例2: OnApplyConfiguration
protected override void OnApplyConfiguration(Binding binding)
{
base.OnApplyConfiguration(binding);
BasicHttpBinding bpBinding = (BasicHttpBinding)binding;
bpBinding.MessageEncoding = this.MessageEncoding;
this.Security.ApplyConfiguration(bpBinding.Security);
}
示例3: IssuedSecurityTokenParameters
public IssuedSecurityTokenParameters (string tokenType,
EndpointAddress issuerAddress, Binding issuerBinding)
{
token_type = tokenType;
issuer_address = issuerAddress;
binding = issuerBinding;
}
示例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();
}
示例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;
}
示例6: OnApplyConfiguration
protected override void OnApplyConfiguration(Binding binding)
{
base.OnApplyConfiguration(binding);
MsmqIntegrationBinding miBinding = (MsmqIntegrationBinding) binding;
miBinding.SerializationFormat = this.SerializationFormat;
this.Security.ApplyConfiguration(miBinding.Security);
}
示例7: GetCredentialTypeForBinding
public string GetCredentialTypeForBinding(Binding binding)
{
if (binding.Scheme.Equals("http", StringComparison.OrdinalIgnoreCase))
return "Username";
return "Certificate";
}
示例8: AnnouncementEndpoint
public AnnouncementEndpoint (DiscoveryVersion discoveryVersion, Binding binding, EndpointAddress address)
: base (null, binding, address)
{
if (discoveryVersion == null)
throw new ArgumentNullException ("discoveryVersion");
DiscoveryVersion = discoveryVersion;
}
示例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);
}
示例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"));
}
示例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);
}
示例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;
}
}
示例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();
}
示例15: GetBindingForBinding
public string GetBindingForBinding(Binding binding)
{
if (binding.Scheme.Equals("http", StringComparison.OrdinalIgnoreCase))
return "Soap1_1";
return "NetTcp";
}