单项选择题
You are building a client for a Windows Communication Foundation (WCF) service. You need to create a proxy to consume this service. Which class should you use?()
A. ChannelFactory
C. ClientRuntime
D. CommunicationObject
相关考题
-
单项选择题
A Windows Communication Foundation (WCF) service implements the following contract. [ServiceContract] public interface IHelloService { [OperationContract(WebGet(UriTemplate="hello?name={name}"))] string SayHello(string name);}The implementation is as follows:public class HelloService: IHelloService { public string SayHello(string name) { return "Hello " + name; }}The service is self-hosted, and the hosting code is as follows:WebServiceHost svcHost = CreateHost();svcHost.Open();Console.ReadLine();svcHost.Close();You need to implement CreateHost so that the service has a single endpoint hosted at http://localhost:8000/HelloService.Which code segment should you use?()
A.
B.
C.
D. -
单项选择题
A Windows Communication Foundation (WCF) service is self-hosted in a console application. The service implements the IDataAccess contract, which is defined in the MyApplication namespace. The service is implemented in a class named DataAccessService which implements the IDataAccess interface and also is defined in the MyApplication namespace. The hosting code is as follows. (Line numbers are included for reference only.) 01 static void Main(string[] args) 02 { 03 ServiceHost host; 04 ... 05 host.Open(); 06 Console.ReadLine(); 07 host.Close(); 08 } You need to create a ServiceHost instance and assign it to the host variable. You also need to instantiate the service host.Which line of code should you insert at line 04?()
A. host = new ServiceHost("MyApplication.DataAccessService");
B. host = new ServiceHost("MyApplication.DataAccess");
C. host = new ServiceHost(typeof(IDataAccess));
D. host = new ServiceHost(typeof(DataAccessService)); -
单项选择题
A Windows Communication Foundation (WCF) service listens for messages at net.tcp://www.contoso.com/MyService.It has a logical address at http://www.contoso.com/MyService. The configuration for the WCF client is as follows:The generated configuration does not provide enough information for the client to communicate with the server.You need to update the client so that it can communicate with the server. What should you do?()
A. In the client configuration, change the value of the address attribute to net.tcp://www.contoso.com/MyService
B. In the client configuration, change the value of the address attribute to net.tcp://www.contoso.com/MyService listen=http://www.contoso.com/MyService.
C. After instantiating the client and before invoking any service operation, add this line of code. EndpointBehaviors.Add(new EndpointDiscoveryBehavior(){ Enabled = true });
D. After instantiating the client and before invoking any service operation, add this line of code. client.Endpoint.Behaviors.Add(new ClientViaBehavior(new Uri("net.tcp://www.contoso.com/IMyService")));
