NetEventRelayBinding 类
TOC
折叠目录
展开目录
此文章由机器翻译。 将光标移到文章的句子上,以查看原文。
译文
原文

NetEventRelayBinding 类

 

代表一个绑定,该绑定支持单向事件多播,并允许任意数目的事件发布程序和事件使用程序在同一个终结点上集合。

命名空间:   Microsoft.ServiceBus
程序集:  Microsoft.ServiceBus(Microsoft.ServiceBus.dll 中)

System.Object
  System.ServiceModel.Channels.Binding
    Microsoft.ServiceBus.NetOnewayRelayBinding
      Microsoft.ServiceBus.NetEventRelayBinding

public class NetEventRelayBinding : NetOnewayRelayBinding, IBindingRuntimePreferences

名称说明
System_CAPS_pubmethodNetEventRelayBinding()

初始化的新实例 NetEventRelayBinding 类。

System_CAPS_pubmethodNetEventRelayBinding(EndToEndSecurityMode, RelayEventSubscriberAuthenticationType)

使用指定的安全模式和中继客户端身份验证类型初始化 NetEventRelayBinding 类的新实例。

System_CAPS_protmethodNetEventRelayBinding(RelayedOnewayTransportBindingElement, BinaryMessageEncodingBindingElement, NetOnewayRelaySecurity)

使用指定的传输、编码和安全元素初始化 NetEventRelayBinding 类的新实例。

System_CAPS_pubmethodNetEventRelayBinding(String)

使用指定的配置初始化 NetEventRelayBinding 类的新实例。

名称说明
System_CAPS_pubpropertyCloseTimeout

(从 Binding 继承。)

System_CAPS_pubpropertyEnvelopeVersion

获取此绑定处理的消息所用的 SOAP 版本。(从 NetOnewayRelayBinding 继承。)

System_CAPS_pubpropertyListenBacklog

获取或设置可以挂起的最大排队连接请求数。(从 NetOnewayRelayBinding 继承。)

System_CAPS_pubpropertyMaxBufferPoolSize

获取或设置用于存储绑定处理的消息的缓冲区池的最大允许大小。(从 NetOnewayRelayBinding 继承。)

System_CAPS_pubpropertyMaxBufferSize

获取或设置一个值,用于指定在内存中存储消息所用的缓冲区的最大大小(以字节为单位)。(从 NetOnewayRelayBinding 继承。)

System_CAPS_pubpropertyMaxConnections

获取或设置一个值,用于控制要进行集区以便将来在客户端上重复使用的最大连接数,以及允许在服务器上等待调度的最大连接数。(从 NetOnewayRelayBinding 继承。)

System_CAPS_pubpropertyMaxReceivedMessageSize

获取或设置绑定处理的已接收消息的最大大小。(从 NetOnewayRelayBinding 继承。)

System_CAPS_protpropertyMessageSecurityVersion

获取消息安全性版本。(从 NetOnewayRelayBinding 继承。)

System_CAPS_pubpropertyMessageVersion

(从 Binding 继承。)

System_CAPS_pubpropertyName

(从 Binding 继承。)

System_CAPS_pubpropertyNamespace

(从 Binding 继承。)

System_CAPS_pubpropertyOpenTimeout

(从 Binding 继承。)

System_CAPS_pubpropertyReaderQuotas

获取或设置使用此绑定配置的终结点可处理的 SOAP 消息的复杂性限制。(从 NetOnewayRelayBinding 继承。)

System_CAPS_pubpropertyReceiveTimeout

(从 Binding 继承。)

System_CAPS_pubpropertyScheme

获取传输的 URI 方案。(从 NetOnewayRelayBinding 继承。)

System_CAPS_pubpropertySecurity

获取一个指定了安全类型的对象,该安全类型可用于通过此绑定配置的服务。(从 NetOnewayRelayBinding 继承。)

System_CAPS_pubpropertySendTimeout

(从 Binding 继承。)

名称说明
System_CAPS_protmethodApplyConfiguration(String)

将指定名称的相应配置元素中的设置应用到此绑定元素的当前实例。(替代 NetOnewayRelayBinding.ApplyConfiguration(String)。)

System_CAPS_pubmethodBuildChannelFactory<TChannel>(BindingParameterCollection)

(从 Binding 继承。)

System_CAPS_pubmethodBuildChannelFactory<TChannel>(Object[])

(从 Binding 继承。)

System_CAPS_pubmethodBuildChannelListener<TChannel>(BindingParameterCollection)

(从 Binding 继承。)

System_CAPS_pubmethodBuildChannelListener<TChannel>(Object[])

(从 Binding 继承。)

System_CAPS_pubmethodBuildChannelListener<TChannel>(Uri, BindingParameterCollection)

(从 Binding 继承。)

System_CAPS_pubmethodBuildChannelListener<TChannel>(Uri, Object[])

(从 Binding 继承。)

System_CAPS_pubmethodBuildChannelListener<TChannel>(Uri, String, BindingParameterCollection)

(从 Binding 继承。)

System_CAPS_pubmethodBuildChannelListener<TChannel>(Uri, String, ListenUriMode, BindingParameterCollection)

(从 Binding 继承。)

System_CAPS_pubmethodBuildChannelListener<TChannel>(Uri, String, ListenUriMode, Object[])

(从 Binding 继承。)

System_CAPS_pubmethodBuildChannelListener<TChannel>(Uri, String, Object[])

(从 Binding 继承。)

System_CAPS_pubmethodCanBuildChannelFactory<TChannel>(BindingParameterCollection)

(从 Binding 继承。)

System_CAPS_pubmethodCanBuildChannelFactory<TChannel>(Object[])

(从 Binding 继承。)

System_CAPS_pubmethodCanBuildChannelListener<TChannel>(BindingParameterCollection)

(从 Binding 继承。)

System_CAPS_pubmethodCanBuildChannelListener<TChannel>(Object[])

(从 Binding 继承。)

System_CAPS_pubmethodCreateBindingElements()

创建一组绑定元素。(从 NetOnewayRelayBinding 继承。)

System_CAPS_pubmethodEquals(Object)

(从 Object 继承。)

System_CAPS_protmethodFinalize()

(从 Object 继承。)

System_CAPS_pubmethodGetHashCode()

(从 Object 继承。)

System_CAPS_pubmethodGetProperty<T>(BindingParameterCollection)

(从 Binding 继承。)

System_CAPS_pubmethodGetType()

(从 Object 继承。)

System_CAPS_protmethodIsBindingElementsMatch(RelayedOnewayTransportBindingElement, BinaryMessageEncodingBindingElement, ReliableSessionBindingElement)

检索用于确定指定的绑定元素是否与当前实例匹配的值。

System_CAPS_protmethodMemberwiseClone()

(从 Object 继承。)

System_CAPS_pubmethodToString()

(从 Object 继承。)

名称说明
System_CAPS_protfieldencoding

代表绑定的编码。 编码与安全设置和传输类型共同代表了绑定的三个核心属性。(从 NetOnewayRelayBinding 继承。)

System_CAPS_protfieldtransport

指定绑定的传输类型。 传输类型与编码和安全设置共同代表了绑定的三个核心属性。(从 NetOnewayRelayBinding 继承。)

Microsoft Azure Service Bus 只支持完全信任代码访问安全性。

System_CAPS_note注意

默认情况下, NetEventRelayBinding 使用传输安全。

NetEventRelayBinding 派生自 NetOnewayRelayBinding 因此, NetEventRelayBinding 继承的属性 NetOnewayRelayBinding 和共享其底层基础结构大部分与此绑定。

不同于任何其他的中继绑定 NetEventRelayBinding 支持在同一 URI 上的多个侦听器。 若要设置一个事件 rendezvous (也称为主题) 的点,客户端和侦听器只是需要对解决方案的作用域内的共享 URI 达成共识,并将发送到或在其上侦听。 通过任何客户端发送的消息获取分发到所有侦听器。

对于当前版本中,将的侦听器数限制以适合使用少于 20 个并发侦听器的部门方案。 通过此绑定发送的消息被限制为最多 60 KB 的传输大小。

没有有关序列或根本传递中到达的消息的保证。

采用其默认设置,NetEventRelayBinding 支持通过使用.NET Framing 和.NET 二进制序列化的 TCP 消息的 SOAP 1.2。

服务和客户端使用 NetEventRelayBinding 使用"sb"URI 方案,而不考虑活动连接模式的 Service Bus 注册其终结点。

通道是受 SSL 保护如果 Security.Mode 属性设置为其中一个 EndToEndSecurityModeTransportTransportWithMessageCredential

传输通道保护可使所有通信来回于中继,但数据是对可见 (但不是通过观察到) 套接字中继点处的服务总线基础结构。

下面的示例演示如何定义和使用 NetEventRelayBinding 与服务和客户端应用程序配置文件中的默认配置。

<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>

下面的示例是与前面的示例类似之处在于它定义的自定义配置 NetEventRelayBinding 它将客户端身份验证关闭,这意味着客户端不需要向 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>

下面的示例演示使用 NetEventRelayBinding 以编程方式使用其默认设置。 默认设置 NetEventRelayBinding 的端到端安全模式和客户端身份验证类型是 EndToEndSecurityMode.TransportRelayClientAuthenticationType.RelayAccessToken 分别。 此示例中是修改后的版本 Net Event 示例中,它指定服务终结点和以编程方式 (而不是在应用程序配置文件中指定它的客户端信道的绑定。 多播 SDK 示例是使用一个聊天应用程序 NetEventRelayBinding

该示例通过指定服务和客户端希望发送到 Service Bus 通过创建终结点行为的凭据来启动。 接下来,它创建绑定、 服务地址,并开始多播的服务主机。 在开始后该服务,通道工厂创建的 IMulticastChannel 通道用于生成服务的客户端通道的类型。 最后,打开客户端通道。

// Configure the credentials for the service and client endpoints through an endpoint behavior. TransportClientEndpointBehavior relayCredentials = new TransportClientEndpointBehavior(); relayCredentials.TokenProvider = TokenProvider.CreateSharedAccessSignatureTokenProvider(keyName, key); // 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();

下面的示例是类似于前面的示例只是它使用 NetEventRelayBinding 使用自定义设置。 它将关闭客户端身份验证,这意味着客户端不需要提供安全令牌到 Service Bus。 由于不需要进行身份验证客户端时,为这些凭据的任何终结点行为不添加到客户端通道。 请注意因为服务应用程序始终使用 Service Bus 进行身份验证,行为仍添加到服务终结点。

// Configure the credentials for the service and client endpoints through an endpoint behavior. TransportClientEndpointBehavior relayCredentials = new TransportClientEndpointBehavior(); relayCredentials.TokenProvider = TokenProvider.CreateSharedAccessSignatureTokenProvider(keyName, key); // 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();

此类型的任何公共静态(Visual Basic 中为 Shared)成员都是线程安全的。但不保证所有实例成员都是线程安全的。

返回页首
显示:
© 2016 Microsoft