What should you do?

You create a Windows Communication Foundation (WCF) application by using Microsoft Visual Studio 2008 and the .NET Framework 3.5. You create a WCF service by using the following code segment. (Line numbers are included for reference only.)

01 [ServiceContract]
02 public interface IContosoService
03 {
04 [OperationContract]
06 void ProcessTransaction();
07 }
09 public class ContosoService : IContosoService
10 {
11 public void ProcessTransaction() {
12 try {
13 BusinessComponent.ProcessTransaction();
14 }
15 catch (ApplicationException appEx) {
17 }
18 }
19 }

The BusinessComponent.ProcessTransaction method will only throw exceptions from the ApplicationException type. You plan to debug the WCF service. You need to ensure that the WCF service meets the following requirements:

Detailed exception information is provided to the client application. Subsequent calls can be issued to the service by using the same proxy intance after an exception is caught in the client application. What should you do?

You create a Windows Communication Foundation (WCF) application by using Microsoft Visual Studio 2008 and the .NET Framework 3.5. You create a WCF service by using the following code segment. (Line numbers are included for reference only.)

01 [ServiceContract]
02 public interface IContosoService
03 {
04 [OperationContract]
06 void ProcessTransaction();
07 }
09 public class ContosoService : IContosoService
10 {
11 public void ProcessTransaction() {
12 try {
13 BusinessComponent.ProcessTransaction();
14 }
15 catch (ApplicationException appEx) {
17 }
18 }
19 }

The BusinessComponent.ProcessTransaction method will only throw exceptions from the ApplicationException type. You plan to debug the WCF service. You need to ensure that the WCF service meets the following requirements:

Detailed exception information is provided to the client application. Subsequent calls can be issued to the service by using the same proxy intance after an exception is caught in the client application. What should you do?

A.
Add the following code segment at line 08.
[ServiceBehavior(IncludeExceptionDetailInFaults=true)]
Add the following code segment at line 16.
throw appEx;

B.
Add the following code segment at line 05.
[FaultContract(typeof(ApplicationException))]
Add the following code segment at line 16.
throw appEx;

C.
Add the following code segment at line 08.
[ServiceBehavior(IncludeExceptionDetailInFaults=true)]
Add the following code segment at line 16.
throw new FaultException<ApplicationException>(appEx);

D.
Add the following code segment at line 05.
[FaultContract(typeof(ApplicationException))]
Add the following code segment at line 16.
throw new FaultException<ApplicationException>(appEx);



Leave a Reply 0

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