其他

A Windows Communication Foundation (WCF) service implements the following contract. [ServiceContract] public interface IHelloService { [OperationContract(WebGet(UriTemplate="hello?name={name}"))]A.B.C.D.

题目
A Windows Communication Foundation (WCF) service implements the following contract. [ServiceContract] public interface IHelloService { [OperationContract(WebGet(UriTemplate="hello?name={name}"))]

A.

B.

C.

D.

如果没有搜索结果,请直接 联系老师 获取答案。
如果没有搜索结果,请直接 联系老师 获取答案。
相似问题和答案

第1题:

假设从键盘输入字符串Smith,以下程序的运行结果是()。 name=input() print("Hello,%s!"%name)

A.Hello,%s!

B.Hello,name!

C.Hello,Smith

D.Hello,Smith!


str[i++] 32。 while语句的循环控制条件既要将相应元素赋予从键盘输入的字符,又要改变元素的下标值,以便接受下一个字符,可用下标变量的后置加实现;小写字母的ASCII码值比相对应的大写形式大32。

第2题:

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.


参考答案:A

第3题:

A Windows Communication Foundation (WCF) solution exposes the following contract over an HTTP connection.[ServiceContract]public interface IDataService{ [OperationContract] string GetData();}Existing clients are making blocking calls to GetData. Calls to GetData take five seconds to complete.You need to allow new clients to issue non-blocking calls to get the data, without breaking any existing clients. What should you do?()

A.

B.

C.Generate a proxy class with asynchronous methods and use it for the new clients

D. Add a new endpoint to the service that uses a full-duplex binding and use it for the new clients.


参考答案:C

第4题:

You are consuming a Windows Communication Foundation (WCF) service in an ASP. NET Web application.The service interface is defined as follows:[ServiceContract]public interface ICatalog{ [OperationContract] [WebGet(UriTemplate="/Catalog/Items/{id}", ResponseFormat=WebMessageFormat.Json)] string RetrieveItemDescription(int id); } The service is hosted at Catalogsvc.You need to call the service using jQuery to retrieve the description of an item as indicated by a variable named itemId. Which code segment should you use?()

A. $get(String.format("/Catalogsvc/Catalog/Items/id{0}", itemId) null, function (data) { ... }, javascript");

B. $get(String.format("/Catalogsvc/Catalog/Items/{0}", itemId), null, function (data) { ... }, "json");

C. $get(String.format("/Catalogsvc/Catalog/Items/{0}", itemld), null, function (data) { ... }, "xml");

D. $get(String.format("/Catalogsvc/Catalog/Items/id{0}", itemld), null, function (data) { ... }, "json");


参考答案:B

第5题:

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 Manager

B. Add a PrincipalPermission attribute to the method and set the Roles property to Manager

C. Add a SecurityPermission attribute to the method and set the SecurityAction to Demand

D. 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


参考答案:B

第6题:

A Windows Communication Foundation (WCF) solution uses the following contract:[ServiceContract(SessionMode=SessionMode.Allowed)]public interface IMyService{ [OperationContract(IsTerminating=false)] void Initialize();[OperationContract(IsInitiating=false)] void DoSomething(); [OperationContract(IsTerminating=true)] void Terminate();}You need to change this interface so that: lnitialize is allowed to be called at any time before Terminate is called. DoSomething is allowed to be called only after Initialize is called, and not allowed to be called after Terminate is called. Terminate will be allowed to be called only after Initalize is called.Which two actions should you perform? (Each correct answer presents part of the sdution. Choose two)()。

A. Change the ServiceContract attribute of the IMyService interface to the following. [ServiceContract(SessionMode=SessionMode.Required)]

B. Change the ServiceContract attrbute of the IMyService interface to the following [ServiceContract(SessionMode=SessionMode.Allowed)]

C. Change the OperationContract attribute of the Initialize operation to the following. [OperationContract(IsInitiating = true, IsTerminating = false)]

D. Change the OperationContract attribute of the Terminate operation to the following [OperationContract(IsInitiating = false, IsTerminating = true)]


参考答案:A, D

第7题:

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.)()


参考答案:C, D

第8题:

You are developing a Windows Communication Foundation (WCF) service. The following code defines and implements the service. (Line numbers are included for reference only.)01 [ServiceContract(SessionMode = SessionMode.Allowed)]02 public interface ICatchAll03 {04 [OperationContract(IsOneWay = false, Action = "*", ReplyAction = "*")]05 Message ProcessMessage(Message message);06 }0708 public class CatchAllService : ICatchAll09 {10 public Message ProcessMessage(Message message)11 {1213 ...14 return returnMsg;15 }16 }You need to ensure that two identical copies of the received message are created in the service.Which code segment should you insert at line 12?()

A.

B.

C.

D.


参考答案:B

第9题:

You are developing a Windows Communication Foundation (WCF) REST service to provide access to a library book catalog. The following code segment defines the service contract. (Line numbers are included for reference only.)01 [ServiceContract()]02 [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]03 public Class LibraryService04 {05 public Book GetBookByTitle(string title)06 {07 ...08 }0910 [WebGet(UriTemplate = "Book/{id}")]11 public Book GetBookById(string id)12 {13 ...14 }15 }Library patrons want the ability to search the catalog by title.You need to ensure that the GetBookByTitle method is exposed as a service method.Which code segment should you insert at line 04?()

A. [WebGet(UriTemplate = "Book/{title}")]

B. [WebGet(UriTemplate = "BookByTitle/{title}")]

C. [WebGet(UriTemplate = "Book/{titleToSearch}")]

D. [WebGet(UriTemplate = "{titleToSearch}")]


参考答案:B