单项选择题
You are developing a client application that uses the following code to consume a Windows Communication Foundation (WCF) service.(Line numbers are included for reference only.)
01 BasicHttpBinding myBinding = new BasicHttpBinding();
02 EndpointAddress myEndpointAddress = new EndpointAddress("http://contoso.com/TaxService.svc");
03 ...
04 ITaxService client = channelFactory.CreateChannel();
05 string data = client.GetData(1);
You need to consume the service.
Which code segment should you insert at line 03?()
A. var channelFactory = new ChannelFactory
B. var channelFactory = new ChannelFactory
C. var channelFactory = new ChannelFactory
D. var channelFactory = new ChannelFactory
相关考题
-
单项选择题
You are creating a Windows Communication Foundation (WCF) service. The service endpoints change frequently. On the service, you add a new ServiceDiscoveryBehavior to the Behaviors collection of the ServiceHost Description property. You need to ensure that client applications can communicate with the service and discover changes to the service endpoints. What should you do?()
A. Add a new ServiceDiscoveryBehavior to the Behaviors collection in the client application.
B. Add a new AnnouncementClient to the Behaviors collection in the client application.
C. Use the FindCriteria class and the UdpDiscoveryEndpoint class to set up the binding in the client application.
D. Use the DiscoveryProxy class and the EndpointDiscoveryMetadata class to set up the binding in the client application. -
单项选择题
You develop a Windows Communication Foundation (WCF) service that interacts with Microsoft Message Queuing (MSMQ). The service requires sessions. You need to create a custom binding that enables messages sent to the queue to be viewed when you are using a listener tool. Which binding elements should you use?()
A. textMessageEncoding and msmqTransport in this order.
B. textMessageEncoding and msmqIntegrationTransport in this order.
C. msmqTransport and textMessageEncoding in this order.
D. msmqIntegrationTransport and textMessageEncoding in this order. -
多项选择题
You develop a Windows Communication Foundation (WCF) service that employees use to access bonus information.You define the following service contract. (Line numbers are included for reference only.) 01 [ServiceContract(SessionMode = SessionMode.Required)] 02 public interface IFinancialService 03 { 04 [OperationContract] 05 string Login(int employeeID, string passwordHash); 06 07 [OperationContract] 08 double GetBonus(int month); 09 10 [OperationContract(IsTerminating = true)] 11 void Logout(); 12 } Client application can invoke methods without logging in. You need to ensure that the client applications invoke Login before invoking any other method. You also need to ensure that client applications cannot consume the service after invoking Logout. Which two action should you perform? ()(Each correct answer presents part of the solution. Choose two.)。
A. Replace line 04 with the following code. [OperationContract(IsInitiating = false)]
B. Replace line 04 with the following code. [OperationContract(IsInitiating = true, IsTerminating = true)]
C. Replace line 07 with the following code. [OperationContract(IsInitiating = false)]
D. Replace line 10 with the following code. [OperationContract(IsInitiating = false, IsTerminating = true)]
