ChannelDispatcher.ReceiveSynchronously Propriedade

Definição

Obtém ou define um valor que especifica se o dispatcher usa chamadas síncronas para ler mensagens de canais.Gets or sets a value that specifies whether the dispatcher uses synchronous calls to read messages from channels.

public:
 property bool ReceiveSynchronously { bool get(); void set(bool value); };
public bool ReceiveSynchronously { get; set; }
member this.ReceiveSynchronously : bool with get, set
Public Property ReceiveSynchronously As Boolean

Valor da propriedade

trueSe o Dispatcher usar métodos síncronos para ler mensagens de canais; caso contrário false,.true if the dispatcher uses synchronous methods to read messages from channels; otherwise, false. O padrão é false.The default is false.

Exceções

O objeto de comunicação está em um estado Opening ou Opened.The communication object is in an Opening or Opened state.

O objeto de comunicação está em um estado Closing ou Closed.The communication object is in a Closing or Closed state.

O objeto de comunicação está em um estado Faulted.The communication object is in a Faulted state.

Exemplos

Uri baseAddress = new Uri("http://localhost:8001/Simple");
ServiceHost serviceHost = new ServiceHost(typeof(CalculatorService), baseAddress);

serviceHost.AddServiceEndpoint(
    typeof(ICalculator),
    new WSHttpBinding(),
    "CalculatorServiceObject");

serviceHost.Open();

IChannelListener icl = serviceHost.ChannelDispatchers[0].Listener;
ChannelDispatcher dispatcher = new ChannelDispatcher(icl);
bool receiveSynchronously = dispatcher.ReceiveSynchronously;
Dim baseAddress As New Uri("http://localhost:8001/Simple")
Dim serviceHost As New ServiceHost(GetType(CalculatorService), baseAddress)

serviceHost.AddServiceEndpoint(GetType(ICalculator), New WSHttpBinding(), "CalculatorServiceObject")

serviceHost.Open()

Dim icl As IChannelListener = serviceHost.ChannelDispatchers(0).Listener
Dim dispatcher As New ChannelDispatcher(icl)
Dim receiveSynchronously As Boolean = dispatcher.ReceiveSynchronously

Comentários

Se uma associação implementar IBindingRuntimePreferences, Windows Communication Foundation (WCF) atribuirá o valor ReceiveSynchronously da propriedade a essa propriedade.If a binding implements IBindingRuntimePreferences, Windows Communication Foundation (WCF) assigns the value of the ReceiveSynchronously property to this property. Portanto, se esse valor truefor, false o valor padrão ReceiveSynchronously de será substituído.So if this value is true, the false default value of ReceiveSynchronously is overridden.

Essa propriedade só pode ser definida quando a instância do ChannelDispatcher está Created no estado, pois esse é o único Estado que é mutável e não Descartado.This property can only be set when the instance of the ChannelDispatcher is in the Created state, as this is the only state that is both mutable and not disposed.

Aplica-se a