PrepAway - Latest Free Exam Questions & Answers

You need to create a duplex contract

You are developing a WCF service.
You need to create a duplex contract.
What should you do? (Each correct answer presents part of the solution. Choose all that apply.)

PrepAway - Latest Free Exam Questions & Answers

A.
Apply the MessageContractAttribute attribute to every public method signature included in the
appropriate contract.

B.
Create an interface for the client-side duplex contract.

C.
Create an interface for the server-side duplex contract.

D.
Apply the MessageContractAttribute attribute to the appropriate interface.

E.
Apply the ServiceContractAttribute attribute to the appropriate interface. Then, apply the
OperationContractAttribute attribute to every public method signature included in that contract.

F.
Set the CallbackContract property to the appropriate interface.

Explanation:
To create a duplex contract
1. (C) Create the interface that makes up the server side of the duplex contract.
2. (E) Apply the ServiceContractAttribute class to the interface.
3. Declare the method signatures in the interface.
4. (E) Apply the OperationContractAttribute class to each method signature that must be part of
the public contract.
5. Create the callback interface that defines the set of operations that the service can invoke on
the client.
6. Declare the method signatures in the callback interface.
7. Apply the OperationContractAttribute class to each method signature that must be part of the
public contract.
8. (F) Link the two interfaces into a duplex contract by setting the CallbackContract property in the
primary interface to the type of the callback interface.

How to: Create a Duplex Contract

6 Comments on “You need to create a duplex contract

    1. Andrii says:

      Hm, it is one of possible ways. But, you could autogenerate the interface using add service reference or use shared lib between server and client with that interface. that is why I hate these questions – often there are more than one valid answers.




      1



      0

Leave a Reply