A Windows Communication Foundation (WCF) solution provides a session-based counter.
The service is self-hosted. The hosting code is as follows. Dim host As ServiceHost = New
ServiceHost(GetType(CounterService)) Dim bnding As NetTcpBinding = New
NetTcpBinding(SecurityMode.None) host.AddServiceEndpoint(”MyApplication.
ICounterService”, binding, “net.tcp://localhost:23456”) host. Open() This service is currently
exposed over TCP, but needs to be exposed to external clients over HTTP. Therefore, a
new service endpoint is created with the following code.
host.AddServiceEndpoint(‘’MyApplication. lCounterService”, binding2,
“http:/!localhost:12345’ You need to complete the implementation and ensure that the
session-based counter will perform over HTTP as it does over TCP. What should you do?
A.
Define binding2 as follows. Dim binding2 As BasicHttpBinding = New
BasicHttpBinding(BasicHttpSecurityMode. None) add the following behavior to the service
implementation. <ServiceBehavior(lnstanceContextMode: 1nstanceContextMode.Single)>
B.
Define binding2 as follows. Dim binding2 As BasicHttpBinding = New
BasicHttpBinding(BasicHttpSecurityMode.None) Enable cookies for binding2.
binding2.AllowCookies = True
C.
Define binding2 as follows. Dim binding2 As WS2007HttpBinding = New
WS200lHttpBinding(SecurityMode. None) Configure binding2 as follows.
binding2.ReliableSession.Enabled = True
D.
Define binding2 as follows. Dim binding2 As WSHttpBinding = — New
WSHttpBinding(SecurityMode.None) Add the following behavior to the service
implementation. <ServceBehavior(lnstanceContextMode:
1nstanceContextMode.PerSession)s