单选题You are developing a Windows Communication Foundation (WCF) service.One of the service operations contains the following code.private static int counter = 0;[OperationContract]public void IncrementCount( ){ counter++;}You need to set a service behavior that prevents two or more threads from incrementing the counter variable at the same time. Which code segment should you use to set the service behavior?()A[ServiceBehavior(InstanceContextMode = InstanceContextMode.Single, ConcurrencyMode = ConcurrencyMode.Single)]B[ServiceBehavior(InstanceContextMode = InstanceContextMode.PerSession, ConcurrencyMode = ConcurrencyMode.Single)]C[ServiceBehavior(InstanceContextMode = InstanceContextMode.Single, ConcurrencyMode = ConcurrencyMode.Multiple)]D[ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall, ConcurrencyMode = ConcurrencyMode.Reentrant)]

单选题
You are developing a Windows Communication Foundation (WCF) service.One of the service operations contains the following code.private static int counter = 0;[OperationContract]public void IncrementCount( ){ counter++;}You need to set a service behavior that prevents two or more threads from incrementing the counter variable at the same time. Which code segment should you use to set the service behavior?()
A

[ServiceBehavior(InstanceContextMode = InstanceContextMode.Single, ConcurrencyMode = ConcurrencyMode.Single)]

B

[ServiceBehavior(InstanceContextMode = InstanceContextMode.PerSession, ConcurrencyMode = ConcurrencyMode.Single)]

C

[ServiceBehavior(InstanceContextMode = InstanceContextMode.Single, ConcurrencyMode = ConcurrencyMode.Multiple)]

D

[ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall, ConcurrencyMode = ConcurrencyMode.Reentrant)]


参考解析

解析: 暂无解析

相关考题:

You are developing a Windows Comunication Foundation (WCF) service that is used to check the status of orders placed by customers.The following code segment is part of your service.(Line numbers are included for reference only.)01 [ServiceContract]02 public interface IStatus03 {04 [OperationContract]05 int GetOrderStatus(string orderNumber);06 }0708 class OrderService : IStatus09 {10 public int GetOrderStatus(string orderNumber)11 {12 ...13 }14 }1516 class Program17 {18 static void Main(string[] args)19 {202122 host.Open();23 ...24 }25 }You need to ensure that the service always listens at net.pipe://SupplyChainServer/Pipe.What should you do?()A.B.C.D.

You are developing a Windows Service. The Windows Service will host a Windows Communication Foundation (WCF) service.The Windows Service class will inherit from ServiceBase.You need to ensure that the WCF service starts when the Windows Service is restarted.What should you do in the Windows Service class?()A.B.C.D.

You are developing a client application that consumes a Windows Communication Foundation (WCF) service.The operation contract is as follows.[OperationContract][FaultContract(typeof(SalesFault))]string GetSales(string saleId);()The service configuration file contains the following line in the serviceBehaviors section.A divide-by-zero exception is not being handled by the service.You need to ensure that the exception is caught in the client application.Which type of exception should the client catch?()A. TimeoutExceptionB. FaultExceptionC. DivideByZeroExceptionD. FaultExceptionSalesFault

You are developing a Windows Communication Foundation (WCF) service to replace an existing ASMX Web service.The WCF service contains the following code segment. (Line numbers are included for reference only.)01 [ServiceContract()]0203 public interface IEmployeeService04 {05 [OperationContract()]06 EmployeeInfo GetEmployeeInfo(int employeeID);0708 }0910 public class EmployeeService : IEmployeeService11 {1213 public EmployeeInfo GetEmployeeInfo(int employeeID)14 {15 ...16 }17 }181920 public class EmployeeInfo21 {22 ...23 public int EmployeeID { get; set; }24 public string FirstName { get; set; }25 public string LastName { get; set; }2627 }The existing Web service returns the EmployeelD as an attribute of the Employeelnfo element in the response XML.You need to ensure that applications can consume the service without code changes in the client.What should you do?()

A Windows Communication Foundation (WCF) service is required to log all authorization attempts to the Windows Event Log. You need to configure a behavior and apply it to the service to support this requirement. Which behavior should you configure and apply?()A. service Authentication ManagerB. service AuthorizationC. service CredentialsD. service Security Audit

You are creating a Windows Communication Foundation (WCF) service that implements the following service contract.[ServiceContract]public interface IOrderProcessing { [OperationContract] void ApproveOrder(int id);}You need to ensure that only users with the Manager role can call the ApproveOrder method. What should you do?()A. In the method body, check the Rights PosessesProperty property to see if it contains ManagerB. Add a PrincipalPermission attribute to the method and set the Roles property to ManagerC. Add a SecurityPermission attribute to the method and set the SecurityAction to DemandD. In the method body, create a new instance of WindowsClaimSet. Use the FindClaims method to locate a claimType named Role with a right named Manager

A Windows Communication Foundation (WCF) service uses the following service contract. [ServiceContract] public interface IService{ [OperationContract] string Operation1(string s);}You need to ensure that the operation contract Operation1 responds to HTTP POST requests.Which code segment should you use?()A.B.C.D.

You are developing a client that sends several types of SOAP messages to a Windows Communication Foundation (WCF) service method named PostData. PostData is currently defined as follows:[OperationContract]void PostData(Order data);You need to modify PostData so that it can receive any SOAP message. Which code segment should you use?()A. [OperationContract(IsOneWay=true, Action=*, ReplyAction=*)] void PostData(Order data);B. [OperationContract(IsOneWay=true, Action=*, ReplyAction = *)] void PostData(BodyWriter data);C. [OperationContract] void PostData(BodyWriter data);D. [OperationContract] void PostData(Message data);

You are creating a Windows Communication Foundation (WCF) service that implements the following service contract.[ServiceContract]public interface IOrderProcessing { [OperationContract] void ApproveOrder(int id);}You need to ensure that only users with the Manager role can call the ApproveOrder method. What should you do?()A、In the method body, check the Rights PosessesProperty property to see if it contains ManagerB、Add a PrincipalPermission attribute to the method and set the Roles property to ManagerC、Add a SecurityPermission attribute to the method and set the SecurityAction to DemandD、In the method body, create a new instance of WindowsClaimSet. Use the FindClaims method to locate a claimType named Role with a right named Manager

You are developing a Windows Communication Foundation (WCF) service.One of the service operations contains the following code.private static int counter = 0;[OperationContract]public void IncrementCount( ){ counter++;}You need to set a service behavior that prevents two or more threads from incrementing the counter variable at the same time. Which code segment should you use to set the service behavior?()A、[ServiceBehavior(InstanceContextMode = InstanceContextMode.Single, ConcurrencyMode = ConcurrencyMode.Single)]B、[ServiceBehavior(InstanceContextMode = InstanceContextMode.PerSession, ConcurrencyMode = ConcurrencyMode.Single)]C、[ServiceBehavior(InstanceContextMode = InstanceContextMode.Single, ConcurrencyMode = ConcurrencyMode.Multiple)]D、[ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall, ConcurrencyMode = ConcurrencyMode.Reentrant)]

You are developing a client that sends several types of SOAP messages to a Windows Communication Foundation (WCF) service method named PostData. PostData is currently defined as follows:[OperationContract]void PostData(Order data);You need to modify PostData so that it can receive any SOAP message. Which code segment should you use?()A、[OperationContract(IsOneWay=true, Action="*", ReplyAction="*")] void PostData(Order data);B、[OperationContract(IsOneWay=true, Action="*", ReplyAction = "*")] void PostData(BodyWriter data);C、[OperationContract] void PostData(BodyWriter data);D、[OperationContract] void PostData(Message data);

You have a secured Windows Communication Foundation (WCF) service. You need to track unsuccessful attempts to access the service. What should you do?()A、Set the authorization Manager Type attribute of the service Authorization behavior to Message.B、Set the include Exception Detailsln Faults attribute of the service Debug behavior to true.C、Set the Mode attribute of the security configuration element to Message.D、Set the message Authentication AuditLevel attribute of the service Security Audit behavior to Failure.

A Windows Communication Foundation (WCF) service that handles corporate accounting must be changed to comply with government regulations of auditing and accountability. You need to configure the WCF service to execute under the Windows logged-on identity of the calling application.What should you do?()A、Within the service configuration, add a Service Authorization behavior to the service, and set Impersonate Caller For All Operations to true.B、Within the service configuration, add a Service Authentication Manager behavior to the service, and set Service Authentication Manager Type to Impersonate.C、Within the service configuration, add a serviceSecurityAudit behavior to the service, and set service Authorization AuditLevel to Success Or Failure.D、Within the service configuration, add a ServiceCredentials behavior to the service, and set type to Impersonate.

You are developing a Windows Communication Foundation (WCF) service that contains the following service contract.[ServiceContract( )]public interface IPaymentService{ [OperationContract( )] void RecordPayments(Person person);}public class Person{ ... }public class Employee : Person{ ... }public class Customer : Person{ ... }You need to ensure that RecordPayments can correctly deserialize into an Employee or a Customer object. What should you do?()A、Add the following KnownType attribute to the Employee class and to the Customer class. [KnownType(GetType(Person))]B、Implement the IExtensibleDataObject interface in the Person class.C、Implement the IExtension(ofType(T)) interface in the Person class.D、Add the following KnownType attributes to the Person class. [KnownType(GetType(Employee))] [KnownType(GetType(Customer))]

A Windows Communication Foundation (WCF) service is required to log all authorization attempts to the Windows Event Log. You need to configure a behavior and apply it to the service to support this requirement. Which behavior should you configure and apply?()A、service Authentication ManagerB、service AuthorizationC、service CredentialsD、service Security Audit

You are developing a Windows Communication Foundation (WCF) service to replace an existing ASMX Web service.The WCF service contains the following code segment. (Line numbers are included for reference only.) 01 [ServiceContract( )] 02 03 public interface IEmployeeService 04 { 05 [OperationContract( )] 06 EmployeeInfo GetEmployeeInfo(int employeeID); 07 08 } 09 10 public class EmployeeService : IEmployeeService 11 { 12 13 public EmployeeInfo GetEmployeeInfo(int employeeID) 14 { 15 ... 16 } 17 } 18 19 20 public class EmployeeInfo 21 { 22 ... 23 public int EmployeeID { get; set; } 24 public string FirstName { get; set; } 25 public string LastName { get; set; } 26 27 }The existing Web service returns the EmployeelD as an attribute of the Employeelnfo element in the response XML.You need to ensure that applications can consume the service without code changes in the client. What should you do?()A、Insert the following code at line 02. [DataContractFormat()] Insert the following code at line 22. [DataMember()]B、Insert the following code at line 02. [XmlSerializerFormat()] Insert the following code at line 22. [XmlAtttibute()]C、Insert the following code at line 09. [XmlSerializerFormat()] Insert the following code at line 22. [XmlAttribute()]D、Insert the following code at line 19. [DataContractFormat()] Insert the following code at line 22. [DataMember()]

You are developing a Windows Communication Foundation (WCF) service that does not operate on a duplex channel.You find that operations do not start until all previous operations have finished. The service hosting code contains the following lines.var service = new WarehouseService( ); var host = new ServiceHost(service);You need to ensure that new operations do not wait for previous operations to finish. Which attribute should you use to decorate the service?()A、[ServiceBehavior(InstanceContextMode=InstanceContextMode.Single, ConcurrencyMode=ConcurrencyMode.Multiple)]B、[CallbackBehavior(ConcurrencyMode=ConcurrencyMode.Multiple)]C、[ServiceBehavior(InstanceContextMode=InstanceContextMode.Single, ConcurrencyMode=ConcurrencyMode.Single)]D、[ServiceBehavior(InstanceContextMode=InstanceContextMode.Single, ConcurrencyMode=ConcurrencyMode.Reentrant)]

You are developing a client application that consumes a Windows Communication Foundation (WCF) service. The operation contract is as follows. [OperationContract] [FaultContract(typeof(SalesFault))] string GetSales(string saleId);() The service configuration file contains the following line in the serviceBehaviors section. A divide-by-zero exception is not being handled by the service. You need to ensure that the exception is caught in the client application. Which type of exception should the client catch?()A、TimeoutExceptionB、FaultExceptionC、DivideByZeroExceptionD、FaultExceptionSalesFault

单选题You are developing a Windows Communication Foundation (WCF) service to replace an existing ASMX Web service.The WCF service contains the following code segment. (Line numbers are included for reference only.) 01 [ServiceContract( )] 02 03 public interface IEmployeeService 04 { 05 [OperationContract( )] 06 EmployeeInfo GetEmployeeInfo(int employeeID); 07 08 } 09 10 public class EmployeeService : IEmployeeService 11 { 12 13 public EmployeeInfo GetEmployeeInfo(int employeeID) 14 { 15 ... 16 } 17 } 18 19 20 public class EmployeeInfo 21 { 22 ... 23 public int EmployeeID { get; set; } 24 public string FirstName { get; set; } 25 public string LastName { get; set; } 26 27 }The existing Web service returns the EmployeelD as an attribute of the Employeelnfo element in the response XML.You need to ensure that applications can consume the service without code changes in the client. What should you do?()AInsert the following code at line 02. [DataContractFormat()] Insert the following code at line 22. [DataMember()]BInsert the following code at line 02. [XmlSerializerFormat()] Insert the following code at line 22. [XmlAtttibute()]CInsert the following code at line 09. [XmlSerializerFormat()] Insert the following code at line 22. [XmlAttribute()]DInsert the following code at line 19. [DataContractFormat()] Insert the following code at line 22. [DataMember()]

单选题You are creating a Windows Communication Foundation (WCF) service that implements the following service contract.[ServiceContract]public interface IOrderProcessing { [OperationContract] void ApproveOrder(int id);}You need to ensure that only users with the Manager role can call the ApproveOrder method. What should you do?()AIn the method body, check the Rights PosessesProperty property to see if it contains ManagerBAdd a PrincipalPermission attribute to the method and set the Roles property to ManagerCAdd a SecurityPermission attribute to the method and set the SecurityAction to DemandDIn the method body, create a new instance of WindowsClaimSet. Use the FindClaims method to locate a claimType named Role with a right named Manager

单选题Your company has an existing Windows Communication Foundation (WCF) service that allows business partners to place orders. The service uses netMsmqBinding. You find that processing every order in its own transaction is causing a delay. You need to ensure that the service is configured to process multiple orders in one transaction. What should you do? ()AUse service behavior and set the maxConcurrentCalls attribute.BUse endpoint behavior and set the maxBatchSize attribute.CUse endpoint behavior and set the maxPendingReceives attribute.DUse endpoint behavior.

单选题You are developing a Windows Communication Foundation (WCF) service that contains the following service contract.[ServiceContract( )]public interface IPaymentService{ [OperationContract( )] void RecordPayments(Person person);}public class Person{ ... }public class Employee : Person{ ... }public class Customer : Person{ ... }You need to ensure that RecordPayments can correctly deserialize into an Employee or a Customer object. What should you do?()AAdd the following KnownType attribute to the Employee class and to the Customer class. [KnownType(GetType(Person))]BImplement the IExtensibleDataObject interface in the Person class.CImplement the IExtension(ofType(T)) interface in the Person class.DAdd the following KnownType attributes to the Person class. [KnownType(GetType(Employee))] [KnownType(GetType(Customer))]

单选题You are developing a client that sends several types of SOAP messages to a Windows Communication Foundation (WCF) service method named PostData. PostData is currently defined as follows:[OperationContract]void PostData(Order data);You need to modify PostData so that it can receive any SOAP message. Which code segment should you use?()A[OperationContract(IsOneWay=true, Action=*, ReplyAction=*)] void PostData(Order data);B[OperationContract(IsOneWay=true, Action=*, ReplyAction = *)] void PostData(BodyWriter data);C[OperationContract] void PostData(BodyWriter data);D[OperationContract] void PostData(Message data);

单选题You are developing a client application that consumes a Windows Communication Foundation (WCF) service. The operation contract is as follows. [OperationContract] [FaultContract(typeof(SalesFault))] string GetSales(string saleId);() The service configuration file contains the following line in the serviceBehaviors section. A divide-by-zero exception is not being handled by the service. You need to ensure that the exception is caught in the client application. Which type of exception should the client catch?()ATimeoutExceptionBFaultExceptionCDivideByZeroExceptionDFaultExceptionSalesFault

单选题You are developing a Windows Communication Foundation (WCF) service.One of the service operations contains the following code.private static int counter = 0;[OperationContract]public void IncrementCount( ){ counter++;}You need to set a service behavior that prevents two or more threads from incrementing the counter variable at the same time. Which code segment should you use to set the service behavior?()A[ServiceBehavior(InstanceContextMode = InstanceContextMode.Single, ConcurrencyMode = ConcurrencyMode.Single)]B[ServiceBehavior(InstanceContextMode = InstanceContextMode.PerSession, ConcurrencyMode = ConcurrencyMode.Single)]C[ServiceBehavior(InstanceContextMode = InstanceContextMode.Single, ConcurrencyMode = ConcurrencyMode.Multiple)]D[ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall, ConcurrencyMode = ConcurrencyMode.Reentrant)]

单选题A Windows Communication Foundation (WCF) service is required to log all authorization attempts to the Windows Event Log. You need to configure a behavior and apply it to the service to support this requirement. Which behavior should you configure and apply?()Aservice Authentication ManagerBservice AuthorizationCservice CredentialsDservice Security Audit

单选题You are developing a Windows Communication Foundation (WCF) service that does not operate on a duplex channel.You find that operations do not start until all previous operations have finished. The service hosting code contains the following lines.var service = new WarehouseService( ); var host = new ServiceHost(service);You need to ensure that new operations do not wait for previous operations to finish. Which attribute should you use to decorate the service?()A[ServiceBehavior(InstanceContextMode=InstanceContextMode.Single, ConcurrencyMode=ConcurrencyMode.Multiple)]B[CallbackBehavior(ConcurrencyMode=ConcurrencyMode.Multiple)]C[ServiceBehavior(InstanceContextMode=InstanceContextMode.Single, ConcurrencyMode=ConcurrencyMode.Single)]D[ServiceBehavior(InstanceContextMode=InstanceContextMode.Single, ConcurrencyMode=ConcurrencyMode.Reentrant)]

单选题A Windows Communication Foundation (WCF) service that handles corporate accounting must be changed to comply with government regulations of auditing and accountability. You need to configure the WCF service to execute under the Windows logged-on identity of the calling application.What should you do?()AWithin the service configuration, add a Service Authorization behavior to the service, and set Impersonate Caller For All Operations to true.BWithin the service configuration, add a Service Authentication Manager behavior to the service, and set Service Authentication Manager Type to Impersonate.CWithin the service configuration, add a serviceSecurityAudit behavior to the service, and set service Authorization AuditLevel to Success Or Failure.DWithin the service configuration, add a ServiceCredentials behavior to the service, and set type to Impersonate.