views:

60

answers:

1

Hello there,

Few methods in my WCF service are quite time taking - Generating Reports and Sending E-mails.

According to current requirement, it is required so that Client application just submits the request and then do not wait for the whole process to complete. It will allow user to continue doing other operations in client applications instead of waiting for the whole process to finish.

I am in a doubt over which way to go:

AsyncPattern = true OR  
IsOneWay=true 

Please guide.

A: 

It can be both.

Generally I see no reason for WCF operation to not be asynchronous, other than developer being lazy.


You should not compare them, because they are not comparable.

In short, AsyncPattern=True performs asynchronous invocation, regardless of whether you're returning a value or not.

OneWay works only with void methods, and puts a lock on your thread waiting for the receiver to ack it received the message.

Krzysztof Koźmic
Thank for your reply, Could you please tell what will be the advantage of AsyncPattern = true over IsOneWay=true?
inutan
Okie... well, all the service methods on which I want to implement Asynch/One way, returns void. As I understand, in IsOneWay, thread won't be locked for the whole process to complete, please correct if I am wrong. Do you suggest any good reason for me to use AsyncPattern=True here. Thank you!
inutan
IsOneWay does lock your thread. The only difference is that it does not wait for entire operation to complete on server side. It waits until server side acknowledges that it received the entire message.
Krzysztof Koźmic
I think that locking time should be minimal as I am using netTcpBinding. I was just trying to use IsOneWay on some of my service method as in http://stackoverflow.com/questions/2176701/wcf-service-setting-isonewaytrue-still-results-in-waiting-client. But it seems I am missing something, can you please suggest if I am mistaken at above link.
inutan
Perhaps it has something to do with binding you're using. WCF is a gordian knot of dependencies, it's often hard to tell what affects what.
Krzysztof Koźmic