/// <summary> /// Creates a binding for to use for discovering servers. /// </summary> /// <param name="discoveryUrl">The discovery URL.</param> /// <param name="endpointConfiguration">The endpoint configuration.</param> /// /// <param name="applicationConfiguration">The application configuration.</param> /// <returns></returns> public static DiscoveryClient Create( Uri discoveryUrl, EndpointConfiguration endpointConfiguration, ApplicationConfiguration applicationConfiguration) { if (endpointConfiguration == null) { endpointConfiguration = EndpointConfiguration.Create(); } // check if application configuration contains instance certificate. X509Certificate2 clientCertificate = null; try { if (applicationConfiguration != null && applicationConfiguration.SecurityConfiguration != null && applicationConfiguration.SecurityConfiguration.ApplicationCertificate != null) { clientCertificate = applicationConfiguration.SecurityConfiguration.ApplicationCertificate.Find(true).Result; } } catch { //ignore errors } ITransportChannel channel = DiscoveryChannel.Create(discoveryUrl, endpointConfiguration, new ServiceMessageContext(), clientCertificate); return(new DiscoveryClient(channel)); }
/// <summary> /// Creates a binding for to use for discovering servers. /// </summary> /// <param name="discoveryUrl">The discovery URL.</param> /// <returns></returns> public static DiscoveryClient Create(Uri discoveryUrl) { EndpointConfiguration configuration = EndpointConfiguration.Create(); ITransportChannel channel = DiscoveryChannel.Create(discoveryUrl, configuration, new ServiceMessageContext()); return(new DiscoveryClient(channel)); }
public static DiscoveryChannel Create( Uri discoveryUrl, EndpointConfiguration configuration, Binding binding, string configurationName) { // create a dummy description. EndpointDescription endpoint = new EndpointDescription(); endpoint.EndpointUrl = discoveryUrl.ToString(); endpoint.SecurityMode = MessageSecurityMode.None; endpoint.SecurityPolicyUri = SecurityPolicies.None; endpoint.Server.ApplicationUri = endpoint.EndpointUrl; endpoint.Server.ApplicationType = ApplicationType.DiscoveryServer; DiscoveryChannel channel = new DiscoveryChannel(); channel.Initialize( endpoint, configuration, binding, configurationName); return(channel); }
/// <summary> /// Creates a binding for to use for discovering servers. /// </summary> public static DiscoveryClient Create( ApplicationConfiguration application, Uri discoveryUrl) { var configuration = EndpointConfiguration.Create(); ITransportChannel channel = DiscoveryChannel.Create(application, discoveryUrl, configuration, new ServiceMessageContext()); return new DiscoveryClient(channel); }
/// <summary> /// Creates a binding for to use for discovering servers. /// </summary> public static DiscoveryClient Create( ITransportWaitingConnection connection, EndpointConfiguration configuration) { if (configuration == null) { configuration = EndpointConfiguration.Create(); } ITransportChannel channel = DiscoveryChannel.Create(null, connection, configuration, new ServiceMessageContext()); return new DiscoveryClient(channel); }
/// <summary> /// Creates a binding for to use for discovering servers. /// </summary> public static DiscoveryClient Create( ApplicationConfiguration application, Uri discoveryUrl, EndpointConfiguration configuration) { if (configuration == null) { configuration = EndpointConfiguration.Create(); } ITransportChannel channel = DiscoveryChannel.Create(application, discoveryUrl, configuration, application.CreateMessageContext()); return new DiscoveryClient(channel); }
/// <summary> /// Creates a binding for to use for discovering servers. /// </summary> /// <param name="discoveryUrl">The discovery URL.</param> /// <param name="bindingFactory">The binding factory.</param> /// <param name="configuration">The configuration.</param> /// <returns></returns> public static DiscoveryClient Create(Uri discoveryUrl, BindingFactory bindingFactory, EndpointConfiguration configuration) { if (discoveryUrl == null) { throw new ArgumentNullException("discoveryUrl"); } if (bindingFactory == null) { bindingFactory = BindingFactory.Default; } if (configuration == null) { configuration = EndpointConfiguration.Create(); } ITransportChannel channel = DiscoveryChannel.Create(discoveryUrl, bindingFactory, configuration, new ServiceMessageContext()); return(new DiscoveryClient(channel)); }
/// <summary> /// Creates a new transport channel that supports the IDiscoveryChannel service contract. /// </summary> /// <param name="discoveryUrl">The discovery URL.</param> /// <param name="bindingFactory">The binding factory.</param> /// <param name="endpointConfiguration">The endpoint configuration.</param> /// <param name="messageContext">The message context.</param> /// <returns></returns> public static ITransportChannel Create( Uri discoveryUrl, BindingFactory bindingFactory, EndpointConfiguration endpointConfiguration, ServiceMessageContext messageContext) { // create a dummy description. EndpointDescription endpoint = new EndpointDescription(); endpoint.EndpointUrl = discoveryUrl.ToString(); endpoint.SecurityMode = MessageSecurityMode.None; endpoint.SecurityPolicyUri = SecurityPolicies.None; endpoint.Server.ApplicationUri = endpoint.EndpointUrl; endpoint.Server.ApplicationType = ApplicationType.DiscoveryServer; ITransportChannel channel = CreateUaBinaryChannel( null, endpoint, endpointConfiguration, (System.Security.Cryptography.X509Certificates.X509Certificate2)null, messageContext); // create a WCF XML channel. if (channel == null) { Binding binding = bindingFactory.Create(discoveryUrl.Scheme, endpointConfiguration); DiscoveryChannel wcfXmlChannel = new DiscoveryChannel(); wcfXmlChannel.Initialize( endpoint, endpointConfiguration, binding, null); channel = wcfXmlChannel; } return(channel); }
public static DiscoveryChannel Create( Uri discoveryUrl, EndpointConfiguration configuration, Binding binding, string configurationName) { // create a dummy description. EndpointDescription endpoint = new EndpointDescription(); endpoint.EndpointUrl = discoveryUrl.ToString(); endpoint.SecurityMode = MessageSecurityMode.None; endpoint.SecurityPolicyUri = SecurityPolicies.None; endpoint.Server.ApplicationUri = endpoint.EndpointUrl; endpoint.Server.ApplicationType = ApplicationType.DiscoveryServer; DiscoveryChannel channel = new DiscoveryChannel(); channel.Initialize( endpoint, configuration, binding, configurationName); return channel; }
/// <summary> /// Creates a new transport channel that supports the IDiscoveryChannel service contract. /// </summary> /// <param name="discoveryUrl">The discovery URL.</param> /// <param name="bindingFactory">The binding factory.</param> /// <param name="endpointConfiguration">The endpoint configuration.</param> /// <param name="messageContext">The message context.</param> /// <returns></returns> public static ITransportChannel Create( Uri discoveryUrl, BindingFactory bindingFactory, EndpointConfiguration endpointConfiguration, ServiceMessageContext messageContext) { // create a dummy description. EndpointDescription endpoint = new EndpointDescription(); endpoint.EndpointUrl = discoveryUrl.ToString(); endpoint.SecurityMode = MessageSecurityMode.None; endpoint.SecurityPolicyUri = SecurityPolicies.None; endpoint.Server.ApplicationUri = endpoint.EndpointUrl; endpoint.Server.ApplicationType = ApplicationType.DiscoveryServer; ITransportChannel channel = CreateUaBinaryChannel( null, endpoint, endpointConfiguration, (System.Security.Cryptography.X509Certificates.X509Certificate2)null, messageContext); // create a WCF XML channel. if (channel == null) { Binding binding = bindingFactory.Create(discoveryUrl.Scheme, endpointConfiguration); DiscoveryChannel wcfXmlChannel = new DiscoveryChannel(); wcfXmlChannel.Initialize( endpoint, endpointConfiguration, binding, null); channel = wcfXmlChannel; } return channel; }