NetMsmqBinding Construtores

Definição

Inicializa uma nova instância da classe NetMsmqBinding.Initializes a new instance of the NetMsmqBinding class.

Sobrecargas

NetMsmqBinding()

Inicializa uma nova instância da classe NetMsmqBinding.Initializes a new instance of the NetMsmqBinding class.

NetMsmqBinding(NetMsmqSecurityMode)

Inicializa uma nova instância da classe NetMsmqBinding usando o modo de segurança especificado.Initializes a new instance of the NetMsmqBinding class using the specified security mode.

NetMsmqBinding(String)

Inicializa uma nova instância da classe NetMsmqBinding das configurações de um elemento de associação de configuração especificado.Initializes a new instance of the NetMsmqBinding class from the settings of a specified configuration binding element.

NetMsmqBinding()

Inicializa uma nova instância da classe NetMsmqBinding.Initializes a new instance of the NetMsmqBinding class.

public:
 NetMsmqBinding();
public NetMsmqBinding ();
Public Sub New ()

Aplica-se a

NetMsmqBinding(NetMsmqSecurityMode)

Inicializa uma nova instância da classe NetMsmqBinding usando o modo de segurança especificado.Initializes a new instance of the NetMsmqBinding class using the specified security mode.

public:
 NetMsmqBinding(System::ServiceModel::NetMsmqSecurityMode securityMode);
public NetMsmqBinding (System.ServiceModel.NetMsmqSecurityMode securityMode);
new System.ServiceModel.NetMsmqBinding : System.ServiceModel.NetMsmqSecurityMode -> System.ServiceModel.NetMsmqBinding
Public Sub New (securityMode As NetMsmqSecurityMode)

Parâmetros

securityMode
NetMsmqSecurityMode

O modo de segurança com o qual inicializar a nova instância.The security mode with which to initialize the new instance.

Exceções

O valor não é um dos valores NetMsmqSecurityMode.The value is not one of the NetMsmqSecurityMode values.

Exemplos

O código a seguir mostra como construir o NetMsmqBinding com um modo de segurança.The following code shows how to construct the NetMsmqBinding with a security mode.

NetMsmqBinding binding = new NetMsmqBinding(NetMsmqSecurityMode.Message);

Aplica-se a

NetMsmqBinding(String)

Inicializa uma nova instância da classe NetMsmqBinding das configurações de um elemento de associação de configuração especificado.Initializes a new instance of the NetMsmqBinding class from the settings of a specified configuration binding element.

public:
 NetMsmqBinding(System::String ^ configurationName);
public NetMsmqBinding (string configurationName);
new System.ServiceModel.NetMsmqBinding : string -> System.ServiceModel.NetMsmqBinding
Public Sub New (configurationName As String)

Parâmetros

configurationName
String

O valor do atributo configurationName que identifica o elemento binding cujas configurações são usadas para inicializar a associação.The value of the configurationName attribute that identifies the binding element whose settings are used to initialize the binding.

Exemplos

O código a seguir mostra como instanciar uma instância da NetMsmqBinding classe.The following code shows how to instantiate an instance of NetMsmqBinding class.

string queueName = ".\\private$\\ServiceModelSamples";

// Create the transacted MSMQ queue if necessary.
if (!MessageQueue.Exists(queueName))
    MessageQueue.Create(queueName, true);

string baseAddress = "http://localhost:8000/queuedCalculator";
string endpointAddress = "net.msmq://localhost/private/ServiceModelSamples";

// Create a ServiceHost for the CalculatorService type.
using (ServiceHost serviceHost = new ServiceHost(typeof(CalculatorService), new Uri(baseAddress)))
{
    NetMsmqBinding binding = new NetMsmqBinding();
    serviceHost.AddServiceEndpoint(typeof(IQueueCalculator), binding, endpointAddress);

    // Add a MEX endpoint.
    ServiceMetadataBehavior smb = new ServiceMetadataBehavior();
    smb.HttpGetEnabled = true;
    serviceHost.Description.Behaviors.Add(smb);

    // Open the ServiceHostBase to create listeners and start listening for messages.
    serviceHost.Open();

    // The service can now be accessed.
    Console.WriteLine("The service is ready.");
    Console.WriteLine("Press <ENTER> to terminate service.");
    Console.WriteLine();
    Console.ReadLine();

    // Close the ServiceHostBase to shutdown the service.
    serviceHost.Close();
}

Comentários

Esse nome substitui qualquer nome de configuração em tempo de execução que foi atribuído ao NetMsmqBinding elemento em um arquivo de configuração.This name overwrites any configuration name at runtime that was assigned to the NetMsmqBinding element in a configuration file.

Aplica-se a