Frage

Say I have a proxy that sends a message to a WCF server:

NetNamedPipeBinding b = new NetNamedPipeBinding(NetNamedPipeSecurityMode.None);
b.MaxConnections = 1000000;
EndpointAddress address = new EndpointAddress(@"net.pipe://sendmessage");
channelFactory = new ChannelFactory<ISendMessage>(b, address);
proxy = channelFactory.CreateChannel();
proxy.SendMessage("Hello, world.");

Say the SendMessage function has a one-way OperationContract:

[OperationContract(IsOneWay=true)]
void SendMessage(string message);

Does running the line of code, proxy.SendMessage("Hello, world."); guarantee delivery of the message to the server? If not by default, is there a way to guarantee delivery? Say my application crashes, and it crashes right after proxy.SendMessage("Hello, world."); runs, will the message have made it to the server assuming no network glitches?

War es hilfreich?

Lösung

One-way operation ensures that your request is queued on service side. The main difference from request-reply operation is that client unblocks immediately after the server got the message without waiting for operation dispatching. Therefore, there is no way to know operation result, exceptions thrown or even the fact that operation was invoked.

You can read details here http://msdn.microsoft.com/en-us/magazine/cc163537.aspx#S1

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top