You need to ensure that OperationOne and OperationTwo execute under the same transaction context when they are invoked in the same session

A service implements the following contract. (Line numbers are included for reference only.)
The service is implemented as follows. ContosoService uses NetMsmqBinding to listen for
messages. The queue was set up to use transactions for adding and removing messages.
You need to ensure that OperationOne and OperationTwo execute under the same
transaction context when they are invoked in the same session. What should you do?

A service implements the following contract. (Line numbers are included for reference only.)
The service is implemented as follows. ContosoService uses NetMsmqBinding to listen for
messages. The queue was set up to use transactions for adding and removing messages.
You need to ensure that OperationOne and OperationTwo execute under the same
transaction context when they are invoked in the same session. What should you do?

A.
Insert the following attribute to OperationOne on IContosoService.
[TransactionFlow(TransactionFlowOption.Mandatory)] Insert the following attribute to
OperationTwo on IContosoService. [TransactionFlow(TransactionFlowOption.Mandatory)]

B.
Insert the following attribute to OperationOne on ContosoService.
[OperationBehavior(TransactionScopeRequired = true, TransactionAutoComplete = false)]
Insert the following attribute to OperationTwo on ContosoService.
[OperationBehavior(TransactionScopeRequired = true, TransactionAutoComplete = true)]

C.
Add the following XML segment to the application config file in the
system.serviceModel/bindings configuration section. <netMsmqBinding> <binding
name=”contosoTx” durable=”true” receiveContextEnabled=”true” /> </netMsmqBinding>
Then use the NetMsmqBinding named contosoTx to listen for messages from the clients.

D.
Add the following XML segment to the application config file in the
system.serviceModel/bindings configuration section. <customBinding> <binding
name=”contosoTx”> <transactionFlow /> <binaryMessageEncoding /> <msmqTransport
durable=”true” /> </binding> </customBinding> Then use the CustomBinding named
contosoTx to listen for messages from the clients.

Explanation:



Leave a Reply 0

Your email address will not be published. Required fields are marked *