You need to ensure that all clients calling GetMessage will retrieve the updated string if the message is updated by any client calling PutMessage

A Windows Communication Foundation (WCF) solution uses the following contract to share
a message across its clients. (Line numbers are included for reference only.) The code for
the service class is as follows. The service is self-hosted. The hosting code is as follows.
You need to ensure that all clients calling GetMessage will retrieve the updated string if the
message is updated by any client calling PutMessage. What should you do?

A Windows Communication Foundation (WCF) solution uses the following contract to share
a message across its clients. (Line numbers are included for reference only.) The code for
the service class is as follows. The service is self-hosted. The hosting code is as follows.
You need to ensure that all clients calling GetMessage will retrieve the updated string if the
message is updated by any client calling PutMessage. What should you do?

A.
Add the following attribute to the TeamMessageService class, before line 10.
[ServiceBehavior(InstanceContextMode = InstanceContextMode.PecSession) ] Than
change che binding definition on the service at line 25, and on the client to the following.
WSHttpBinding binding = new WSHttpBinding(SecurityMode.None);
binding.ReiiabieSession.Enabled = true;

B.
Pass a service instance to the instancing code in line 24, as follows. ServiceHost host =
new ServiceHost(new TeamMessageService());

C.
Add the following attribute to the TeamMessageService class, before line 10.
[ServiceBehavior(InstanceContextMode = InstanceContextMode.Single)]

D.
Redefine the message string in line 13, as follows. static string message = “Today’ s
Message”; Then change the implementation of PutMessage in lines 19-22 to the following.
public void PutMessage(string message) { TeamMessageService.message = message; >



Leave a Reply 0

Your email address will not be published. Required fields are marked *