1
votes

I created a WCF service contract that works against MSMQ. Since it is MSMQ, I use one-way communication:

[OperationContract(IsOneWay = true)]

In my service implementation, I have OperationBehavior to automatically commit transactions:

[OperationBehavior(TransactionAutoComplete = true, TransactionScopeRequired = true)]

This makes sure WCF handles any exceptions by putting the message on a retry queue (per my configuration). It seems odd to be throwing an exception from a one-way operation. Is this the correct way to tell WCF not to commit the transaction?

1
the question is bit vague? you mean, you are getting exception in the client calling the service, or are you simply seeing an exception in this service method?Dhawalk
i think your problem may be TransactionScopeRequired. check msdn.microsoft.com/en-us/library/…Dhawalk
I am only asking whether throwing exceptions is the correct way to rollback the transaction in WCF when working with MSMQ.Travis Parks

1 Answers

0
votes

After some research, I found that throwing an exception is the only way to tell WCF to use the built-in retry sub-queue. This exception is swallowed by WCF. It is also used to make sure the transaction isn't auto-completed.