You need to implement the error handling code for SearchMessages and create a new channel on the client only if the channel faults

A Windows Communication Foundation (WCF) service implements the following contract.
(Line numbers are included for reference only.) 01 [ServiceContract] 02 public interface
IDataAccessService 03 { 01 [OperationContract] 05 void PutMessage(string message); 06
07 [OperationContract] 08 [FaultContract(typeof(TimeoutFaultException)) ] 09
[FaultContract(typeof(FaultException) ) ] 10 stringf] SearchMessages(string search); 11 }
The implementation of the SearchMessages method throws TimeoutFaultException
exceptions for database timeouts. The implementation of the SearchMessages method also
throws an Exception for any other issue it encounters while processing the request. These
exceptions are received on the client side as generic FaultException exceptions. You need
to implement the error handling code for SearchMessages and create a new channel on the
client only if the channel faults. What should you do?

A Windows Communication Foundation (WCF) service implements the following contract.
(Line numbers are included for reference only.) 01 [ServiceContract] 02 public interface
IDataAccessService 03 { 01 [OperationContract] 05 void PutMessage(string message); 06
07 [OperationContract] 08 [FaultContract(typeof(TimeoutFaultException)) ] 09
[FaultContract(typeof(FaultException) ) ] 10 stringf] SearchMessages(string search); 11 }
The implementation of the SearchMessages method throws TimeoutFaultException
exceptions for database timeouts. The implementation of the SearchMessages method also
throws an Exception for any other issue it encounters while processing the request. These
exceptions are received on the client side as generic FaultException exceptions. You need
to implement the error handling code for SearchMessages and create a new channel on the
client only if the channel faults. What should you do?

A.
Catch and handle FaultException. Catch TimeoutFaultException and create a new
channel.

B.
Catch and handle TimeoutFaultException. Catch FaultException and create a new
channel.

C.
Catch and handle both TimeoutFaultException and FaultException

D.
Catch both TimeoutFaultException and FaultException. Create a new channel in both
cases.



Leave a Reply 0

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