当前位置:MCTS(70-513)题库

问题:

[多选]

A Windows Communication Foundation (WCF) solution uses the following contracts. (Line numbers are included for reference only.)
01 [ServiceContract(CallbackContract=typeof(INameService))]
02 public interface IGreetingService
03 {
04 [OperationContract]
05 string GetMessage();
06 }
07 [ServiceContract]
08 public interface INameService
09 {
10 [OperationContract]
11 string GetName();
12 }
The code that implements the IGreetingService interface is as follows:
20 public class GreetingService : IGreetingService
21{
22 public string GetMessage()
23 {
24 INameService clientChannel = OperationContext.Current.GetCallbackChannel();
25 string clientName = clientChannel.GetName();
26 return String.Format("Hello {0}", clientName);
27 }
28 }
The service is self-hosted. The hosting code is as follows:
30 ServiceHost host = new ServiceHost(typeof(GreetingService));
31 NetTcpBinding binding = new NetTcpBinding(SecurityMode.None);
32 host.AddServiceEndpoint("MyApplication.IGreetingService", binding, "net.tcp//localhost:12345");
33 host.Open();
The code that implements the lNameService interface is as follows:
40 class NameService : INameService
41 {
42 string name;
43 public NameService(string name)
44 {
45 this.name = name;
46 }
47 public string GetName()
48 {
49 return name;
50 }
51 }
Currently, this code fails at runtime, and an InvalidOperationException is thrown at line 25. You need to correct the code so that the call from the service back to the client completes successfully. What are two possible ways to achieve this goal? (Each correct answer presents a complete solution. Choose two.)()

A .
B .
C .
D .

A公司涉及一起诉讼,根据以前的经验及公司所聘请律师的意见判断,该公司在该诉讼中胜诉的可能性有30%,败诉的可能性有70%。如果败诉,A公司将要支付100万元的赔偿款。根据规定,A公司应于年末资产负债表中确认负债金额()。 变质矿床可划分为三个主要成因类型,即 电路交换方式中不需要在两个通信节点之间建立通路。 根据我国现行工程造价构成,属于固定资产投资中积极部分的是()。 建安工程费。 设备及工、器具购臵费。 建设用地费。 可行性研究费。 生产经营单位及其有关人员安全生产违法行为轻微并及时纠正,没有造成危害后果的,()行政处罚。 免除。 从轻或者减轻。 不予。

A Windows Communication Foundation (WCF) solution uses the following contracts. (Line numbers are included for reference only.)
01 [ServiceContract(CallbackContract=typeof(INameService))]
02 public interface IGreetingService
03 {
04 [OperationContract]
05 string GetMessage();
06 }
07 [ServiceContract]
08 public interface INameService
09 {
10 [OperationContract]
11 string GetName();
12 }
The code that implements the IGreetingService interface is as follows:
20 public class GreetingService : IGreetingService
21{
22 public string GetMessage()
23 {
24 INameService clientChannel = OperationContext.Current.GetCallbackChannel();
25 string clientName = clientChannel.GetName();
26 return String.Format("Hello {0}", clientName);
27 }
28 }
The service is self-hosted. The hosting code is as follows:
30 ServiceHost host = new ServiceHost(typeof(GreetingService));
31 NetTcpBinding binding = new NetTcpBinding(SecurityMode.None);
32 host.AddServiceEndpoint("MyApplication.IGreetingService", binding, "net.tcp//localhost:12345");
33 host.Open();
The code that implements the lNameService interface is as follows:
40 class NameService : INameService
41 {
42 string name;
43 public NameService(string name)
44 {
45 this.name = name;
46 }
47 public string GetName()
48 {
49 return name;
50 }
51 }
Currently, this code fails at runtime, and an InvalidOperationException is thrown at line 25. You need to correct the code so that the call from the service back to the client completes successfully. What are two possible ways to achieve this goal? (Each correct answer presents a complete solution. Choose two.)()

参考答案:

  参考解析

本题暂无解析

在线 客服