Example #1
0
        /// <summary>
        /// Creates a <see cref="Binding" /> for the specified <see cref="MessageTransferType" /> with a configurable timeout.
        /// </summary>
        /// <param name="messageTransferType">The <see cref="MessageTransferType" /> to create a binding for.</param>
        /// <param name="timeout">The timeout value for service send/receive operations.</param>
        /// <returns>A <see cref="Binding" /> for the specified <see cref="MessageTransferType" />.</returns>
        public static Binding CreateBinding(MessageTransferType messageTransferType, TimeSpan timeout)
        {
            Binding binding;

            switch (messageTransferType)
            {
            case MessageTransferType.Http:
                binding = CreateHttpBinding();
                break;

            case MessageTransferType.CompressedHttp:
                binding = CreateCompressionBinding();
                break;

            case MessageTransferType.NamedPipe:
                binding = CreateNamedPipeBinding();
                break;

            default:
                throw new ArgumentException($"Unsupported MessageTransferType {messageTransferType}.", nameof(messageTransferType));
            }

            // The only pertinent timeout to set is SendTimeout - this governs the amount of time allowed
            // for round-trip communication, including sending the request, processing, and waiting for the response.
            binding.SendTimeout = timeout;
            return(binding);
        }
Example #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="WcfHost{T}" /> class.
 /// </summary>
 /// <param name="singletonInstance">The singleton instance of the service implementation.</param>
 /// <param name="messageTransferType">The <see cref="MessageTransferType" /> to use for WCF communication.</param>
 /// <param name="uri">The URI at which the service will be hosted.</param>
 /// <exception cref="ArgumentNullException">
 /// <paramref name="singletonInstance" /> is null.
 /// <para>or</para>
 /// <paramref name="uri" /> is null.
 /// </exception>
 public WcfHost(T singletonInstance, MessageTransferType messageTransferType, Uri uri)
     : this(singletonInstance, BindingFactory.CreateBinding(messageTransferType), uri)
 {
 }
Example #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="WcfHost{T}" /> class.
 /// </summary>
 /// <param name="serviceType">The type that will be used to implement the service.</param>
 /// <param name="messageTransferType">The <see cref="MessageTransferType" /> to use for WCF communication.</param>
 /// <param name="uri">The URI at which the service will be hosted.</param>
 /// <exception cref="ArgumentNullException">
 /// <paramref name="serviceType" /> is null.
 /// <para>or</para>
 /// <paramref name="uri" /> is null.
 /// </exception>
 public WcfHost(Type serviceType, MessageTransferType messageTransferType, Uri uri)
     : this(serviceType, BindingFactory.CreateBinding(messageTransferType), uri)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="ClientControllerServiceConnection"/> class.
 /// </summary>
 /// <param name="endpoint">The endpoint.</param>
 /// <param name="transferType"></param>
 private ClientControllerServiceConnection(Uri endpoint, MessageTransferType transferType)
     : base(transferType, endpoint)
 {
 }
Example #5
0
 /// <summary>
 /// Creates a <see cref="Binding" /> for the specified <see cref="MessageTransferType" />.
 /// </summary>
 /// <param name="messageTransferType">The <see cref="MessageTransferType" /> to create a binding for.</param>
 /// <returns>A <see cref="Binding" /> for the specified <see cref="MessageTransferType" />.</returns>
 public static Binding CreateBinding(MessageTransferType messageTransferType)
 {
     return(CreateBinding(messageTransferType, TimeSpan.FromMinutes(10)));
 }
 /// <summary>
 /// Prevents a default instance of the <see cref="SessionProxyBackendConnection"/> class from being created.
 /// </summary>
 /// <param name="endpoint">The endpoint.</param>
 private SessionProxyBackendConnection(MessageTransferType transferType, Uri endpoint)
     : base(transferType, endpoint)
 {
 }
Example #7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="WcfClient{T}" /> class with a configurable timeout.
 /// </summary>
 /// <param name="messageTransferType">The <see cref="MessageTransferType" /> to use for WCF communication.</param>
 /// <param name="endpoint">The endpoint at which the service is hosted.</param>
 /// <param name="timeout">The timeout value for service send/receive operations.</param>
 /// <exception cref="ArgumentNullException"><paramref name="endpoint" /> is null.</exception>
 public WcfClient(MessageTransferType messageTransferType, Uri endpoint, TimeSpan timeout)
     : base(BindingFactory.CreateBinding(messageTransferType, timeout), new EndpointAddress(endpoint))
 {
 }
Example #8
0
 public WcfClient(MessageTransferType messageTransferType, string endpoint, TimeSpan timeout)
     : this(messageTransferType, new Uri(endpoint), timeout)
 {
 }
Example #9
0
 public WcfClient(MessageTransferType messageTransferType, string endpoint)
     : this(messageTransferType, new Uri(endpoint))
 {
 }
Example #10
0
 /// <summary>
 /// Initializes a new instance of the <see cref="VirtualResourceManagementConnection"/> class.
 /// </summary>
 /// <param name="endpoint">The endpoint.</param>
 /// <param name="transferType">the transfer protocol</param>
 private VirtualResourceManagementConnection(Uri endpoint, MessageTransferType transferType)
     : base(transferType, endpoint)
 {
 }