匯出 (0) 列印
全部展開

NetEventRelayBinding 類別

代表支援單向事件多點傳送的繫結,並允許任意數目的事件發行者和事件消費者在相同端點上會合。

命名空間:  Microsoft.ServiceBus
組件:  Microsoft.ServiceBus (在 Microsoft.ServiceBus.dll 中)

public class NetEventRelayBinding : NetOnewayRelayBinding, 
	IBindingRuntimePreferences

NetEventRelayBinding 型別公開下列成員。

  名稱說明
公用方法NetEventRelayBinding()()()()初始化 NetEventRelayBinding 類別的新執行個體。
公用方法NetEventRelayBinding(String)使用指定的組態,初始化 NetEventRelayBinding 類別的新執行個體。
公用方法NetEventRelayBinding(EndToEndSecurityMode, RelayEventSubscriberAuthenticationType)使用指定的安全性模式和轉送用戶端驗證類型,初始化 NetEventRelayBinding 類別的新執行個體。
受保護的方法NetEventRelayBinding(RelayedOnewayTransportBindingElement, BinaryMessageEncodingBindingElement, NetOnewayRelaySecurity)使用指定的傳輸、編碼及安全性元素,初始化 NetEventRelayBinding 類別的新執行個體。
上層

  名稱說明
公用屬性CloseTimeout (繼承自 Binding。)
公用屬性EnvelopeVersion取得此繫結處理之訊息所使用的 SOAP 版本。 (繼承自 NetOnewayRelayBinding。)
公用屬性ListenBacklog取得或設定可以擱置的佇列連線要求數目上限。 (繼承自 NetOnewayRelayBinding。)
公用屬性MaxBufferPoolSize取得或設定允許的緩衝集區大小上限,此集區可儲存繫結所處理的訊息。 (繼承自 NetOnewayRelayBinding。)
公用屬性MaxBufferSize取得或設定值,指定記憶體中用來儲存訊息的緩衝區大小上限 (以位元組為單位)。 (繼承自 NetOnewayRelayBinding。)
公用屬性MaxConnections取得或設定值,控制要置於集區以供後續重複使用於用戶端的連線數目上限,以及允許在伺服器上等待發送的連線數目上限。 (繼承自 NetOnewayRelayBinding。)
公用屬性MaxReceivedMessageSize取得或設定繫結所處理之已接收訊息的大小上限。 (繼承自 NetOnewayRelayBinding。)
受保護的屬性MessageSecurityVersion取得訊息安全性版本。 (繼承自 NetOnewayRelayBinding。)
公用屬性MessageVersion (繼承自 Binding。)
公用屬性Name (繼承自 Binding。)
公用屬性Namespace (繼承自 Binding。)
公用屬性OpenTimeout (繼承自 Binding。)
公用屬性ReaderQuotas取得或設定使用此繫結設定的端點可以處理的 SOAP 訊息複雜度限制。 (繼承自 NetOnewayRelayBinding。)
公用屬性ReceiveTimeout (繼承自 Binding。)
公用屬性Scheme取得傳輸的 URI 配置。 (繼承自 NetOnewayRelayBinding。)
公用屬性Security取得物件,用來指定使用此繫結設定的服務所用的安全性類型。 (繼承自 NetOnewayRelayBinding。)
公用屬性SendTimeout (繼承自 Binding。)
上層

  名稱說明
受保護的方法ApplyConfiguration將對應至指定名稱之組態元素的設定套用至這個繫結元素目前的執行個體。 (覆寫 NetOnewayRelayBinding..::..ApplyConfiguration(String)。)
公用方法BuildChannelFactory<(Of <<'(TChannel>)>>)(array<Object>[]()[][]) (繼承自 Binding。)
公用方法BuildChannelFactory<(Of <<'(TChannel>)>>)(BindingParameterCollection) (繼承自 Binding。)
公用方法BuildChannelListener<(Of <<'(TChannel>)>>)(array<Object>[]()[][]) (繼承自 Binding。)
公用方法BuildChannelListener<(Of <<'(TChannel>)>>)(BindingParameterCollection) (繼承自 Binding。)
公用方法BuildChannelListener<(Of <<'(TChannel>)>>)(Uri, array<Object>[]()[][]) (繼承自 Binding。)
公用方法BuildChannelListener<(Of <<'(TChannel>)>>)(Uri, BindingParameterCollection) (繼承自 Binding。)
公用方法BuildChannelListener<(Of <<'(TChannel>)>>)(Uri, String, array<Object>[]()[][]) (繼承自 Binding。)
公用方法BuildChannelListener<(Of <<'(TChannel>)>>)(Uri, String, BindingParameterCollection) (繼承自 Binding。)
公用方法BuildChannelListener<(Of <<'(TChannel>)>>)(Uri, String, ListenUriMode, array<Object>[]()[][]) (繼承自 Binding。)
公用方法BuildChannelListener<(Of <<'(TChannel>)>>)(Uri, String, ListenUriMode, BindingParameterCollection) (繼承自 Binding。)
公用方法CanBuildChannelFactory<(Of <<'(TChannel>)>>)(array<Object>[]()[][]) (繼承自 Binding。)
公用方法CanBuildChannelFactory<(Of <<'(TChannel>)>>)(BindingParameterCollection) (繼承自 Binding。)
公用方法CanBuildChannelListener<(Of <<'(TChannel>)>>)(array<Object>[]()[][]) (繼承自 Binding。)
公用方法CanBuildChannelListener<(Of <<'(TChannel>)>>)(BindingParameterCollection) (繼承自 Binding。)
公用方法CreateBindingElements建立一組繫結元素。 (繼承自 NetOnewayRelayBinding。)
公用方法Equals (繼承自 Object。)
受保護的方法Finalize (繼承自 Object。)
公用方法GetHashCode (繼承自 Object。)
公用方法GetProperty<(Of <<'(T>)>>) (繼承自 Binding。)
公用方法GetType (繼承自 Object。)
受保護的方法IsBindingElementsMatch擷取值,以判斷指定的繫結元素是否符合目前的執行個體。
受保護的方法MemberwiseClone (繼承自 Object。)
公用方法ShouldSerializeName (繼承自 Binding。)
公用方法ShouldSerializeNamespace (繼承自 Binding。)
公用方法ToString (繼承自 Object。)
上層

  名稱說明
受保護的欄位encoding代表繫結的編碼。除了安全性設定和傳輸類型外,編碼代表繫結的三個核心屬性之一。 (繼承自 NetOnewayRelayBinding。)
受保護的欄位transport指定繫結的傳輸類型。除了編碼和安全性設定外,傳輸類型代表繫結的三個核心屬性之一。 (繼承自 NetOnewayRelayBinding。)
上層

  名稱說明
明確介面實作私用屬性IBindingRuntimePreferences..::..ReceiveSynchronously取得值,此值指出可以透過同步還是非同步方式更有效率地處理傳入的要求。 (繼承自 NetOnewayRelayBinding。)
上層

Windows Azure Service Bus supports only Full Trust code access security.

附註附註

By default, NetEventRelayBinding uses Transport Security.

NetEventRelayBinding is derived from NetOnewayRelayBinding. As such, NetEventRelayBinding inherits the properties of NetOnewayRelayBinding and shares much of its underlying infrastructure with this binding.

Unlike any of the other Relay bindings, the NetEventRelayBinding supports multiple listeners on the same URI. To set up an event rendezvous point (also called topic), the clients and listeners merely need to agree on a shared URI within the scope of a solution and send to or listen on it. Messages that get sent by any of the clients get distributed to all listeners.

For the current release, the number of listeners is constrained to fit departmental scenarios with fewer than 20 concurrent listeners. Messages sent through this binding are constrained to at most 60KB in wire size.

There are no assurances about messages arriving in sequence or being delivered at all.

With its default settings, the NetEventRelayBinding supports SOAP 1.2 messaging over TCP using .NET Framing and .NET Binary Serialization.

Services and Clients using the NetEventRelayBinding register their endpoints on the Windows Azure Service Bus using the "sb" URI scheme, regardless of the active connectivity mode.

The channel is SSL-protected if the Security.Mode property is set to one of the EndToEndSecurityMode values of Transport or TransportWithMessageCredential.

The transport channel protection guards all traffic to and from the Relay, but the data is visible to (but not observed by) the Windows Azure Service Bus infrastructure at the socket relay point.

The following example shows how to define and use NetEventRelayBinding with the default configuration for a service and client in an application configuration file.

<system.serviceModel>

  <bindings>
    <netEventRelayBinding>
      <binding name="default" />
    </netEventRelayBinding>
  </bindings>

  <client>
    <endpoint name="RelayEndpoint"
              contract="Microsoft.ServiceBus.Samples.IMulticastContract"
              binding="netEventRelayBinding"
              bindingConfiguration="default"
              behaviorConfiguration="ReplaceWithEndpointBehaviorName"
              address="ReplaceWithEndpointAddress" />
  </client>
  
  <services>
    <service name="Microsoft.ServiceBus.Samples.MulticastService">
      <!-- Keep address empty to use host base address, or -->
      <!-- replace with endpoint address. -->
      <endpoint name="RelayEndpoint"
                contract="Microsoft.ServiceBus.Samples.IMulticastContract"
                binding="netEventRelayBinding"
                bindingConfiguration="default"
                behaviorConfiguration="ReplaceWithEndpointBehaviorName"
                address="" />
    </service>
  </services>

  <behaviors>
    <endpointBehaviors>
      <!-- Add endpoint behavior here. -->
    </endpointBehaviors>
  </behaviors>

</system.serviceModel>

The following example is similar to the previous example except that it defines a custom configuration for NetEventRelayBinding. It turns client authentication off, which means that the client is not required to present a security token to the Windows Azure Service Bus.

<system.serviceModel>

  <bindings>
    <!-- Application Binding -->
    <netEventRelayBinding>
        <!-- Turn off client authentication -->
      <binding name="customBinding">
        <security relayClientAuthenticationType="None" />
    </netEventRelayBinding>
  </bindings>

  <client>
    <!-- No behavior configuration is added to this endpoint as the client does not need to authenticate. -->
    <endpoint name="RelayEndpoint"
              contract="Microsoft.ServiceBus.Samples.IMulticastContract"
              binding="netEventRelayBinding"
              bindingConfiguration="customBinding"
              address="ReplaceWithEndpointAddress" />
  </client>
  
  <services>
    <service name="Microsoft.ServiceBus.Samples.MulticastService">
      <!-- Keep address empty to use host base address, or -->
      <!-- replace with endpoint address. -->
      <endpoint name="RelayEndpoint"
                contract="Microsoft.ServiceBus.Samples.IMulticastContract"
                binding="netEventRelayBinding"
                bindingConfiguration="customBinding"
                behaviorConfiguration="ReplaceWithEndpointBehaviorName"
                address="" />
    </service>
  </services>

  <behaviors>
    <endpointBehaviors>
      <!-- Add endpoint behavior here. -->
    </endpointBehaviors>
  </behaviors>

</system.serviceModel>

The following example illustrates the use of NetEventRelayBinding programmatically with its default settings. The default settings of NetEventRelayBinding for the end-to-end security mode and client authentication type are EndToEndSecurityMode.Transport and RelayClientAuthenticationType.RelayAccessToken respectively. This example is a modified version of the Multicast SDK sample, which specifies the binding for the service endpoint and the client channel programmatically instead of specifying it in the application configuration file. The Multicast SDK sample is a chat application that uses the NetEventRelayBinding and can be found in the SDK install directory under \Samples\ServiceBus\ExploringFeatures\Bindings\NetEvent.

This example starts by specifying the credentials the service and the client are expected to send to the Windows Azure Service Bus by creating an endpoint behavior. Next, it creates the binding, the service address, and starts the Multicast service host. After starting the service, a channel factory is created for the IMulticastChannel channel type that is used to generate a client channel to the service. Finally, the client channel is opened.

// Configure the credentials for the service and client endpoints through an endpoint behavior.
TransportClientEndpointBehavior relayCredentials = new TransportClientEndpointBehavior();
relayCredentials.CredentialType = TransportClientCredentialType.SharedSecret;
relayCredentials.Credentials.SharedSecret.IssuerName = issuerName;
relayCredentials.Credentials.SharedSecret.IssuerSecret = issuerSecret;

// Create the binding with default settings.
NetEventRelayBinding binding = new NetEventRelayBinding();        

// Get the service URI.
Uri serviceAddress = ServiceBusEnvironment.CreateServiceUri("sb", serviceNamespace,
       String.Format(CultureInfo.InvariantCulture, "{0}/MulticastService/", session));

// Create the Multicast service host.
ServiceHost host = new ServiceHost(typeof(MulticastService), serviceAddress);
// Add the service endpoint with the NetEventRelayBinding binding.
host.AddServiceEndpoint(typeof(IMulticastContract), binding, serviceAddress);
// Add the credentials through the endpoint behavior.
host.Description.Endpoints[0].Behaviors.Add(relayCredentials);
// Start the service.
host.Open();

// Create a channel factory for the IMulticastChannel channel type.
// This channel factory is used to create client channels to the Multicast service. 
// Each client channel the channel factory creates is configured to use the 
// NetEventRelayBinding that is passed to the constructor of the channel factory.
ChannelFactory<IMulticastChannel> channelFactory = new ChannelFactory<IMulticastChannel>(
    binding, new EndpointAddress(serviceAddress));
channelFactory.Endpoint.Behaviors.Add(relayCredentials);

// Create and open the client channel.
IMulticastChannel channel = channelFactory.CreateChannel();
channel.Open();

The following example is similar to the previous example except that it uses NetEventRelayBinding with custom settings. It turns off client authentication, which means that the client is not required to present a security token to the Windows Azure Service Bus. Since the client is not required to authenticate, no endpoint behavior for the credentials is added to the client channel. Note that the behavior is still added to the service endpoint because the service application always authenticates with the Windows Azure Service Bus.

// Configure the credentials for the service and client endpoints through an endpoint behavior.
TransportClientEndpointBehavior relayCredentials = new TransportClientEndpointBehavior();
relayCredentials.CredentialType = TransportClientCredentialType.SharedSecret;
relayCredentials.Credentials.SharedSecret.IssuerName = issuerName;
relayCredentials.Credentials.SharedSecret.IssuerSecret = issuerSecret;

// Create the binding with custom settings.
NetEventRelayBinding binding = new NetEventRelayBinding();        
// The client is not required to present a security token to the AppFabric Service Bus.
binding.Security.RelayClientAuthenticationType = RelayClientAuthenticationType.None;

// Get the service URI.
Uri serviceAddress = ServiceBusEnvironment.CreateServiceUri("sb", serviceNamespace,
       String.Format(CultureInfo.InvariantCulture, "{0}/MulticastService/", session));

// Create the Multicast service host.
ServiceHost host = new ServiceHost(typeof(MulticastService), serviceAddress);
// Add the service endpoint with the NetEventRelayBinding binding.
host.AddServiceEndpoint(typeof(IMulticastContract), binding, serviceAddress);
// Add the credentials through the endpoint behavior.
host.Description.Endpoints[0].Behaviors.Add(relayCredentials);
// Start the service.
host.Open();

// Create a channel factory for the IMulticastChannel channel type.
// This channel factory is used to create client channels to the Multicast service. 
// Each client channel the channel factory creates is configured to use the 
// NetEventRelayBinding that is passed to the constructor of the channel factory.
ChannelFactory<IMulticastChannel> channelFactory = new ChannelFactory<IMulticastChannel>(
    binding, new EndpointAddress(serviceAddress));

// Create and open the client channel.
IMulticastChannel channel = channelFactory.CreateChannel();
channel.Open();

這個型別的任何公用 static (在 Visual Basic 中為 Shared) 成員都是執行緒安全的。並不是所有的執行個體成員都保證可以用於所有的執行緒。

社群新增項目

新增
顯示:
© 2014 Microsoft