Which code segment should you use?

You are creating a Windows Communication Foundation service by using Microsoft .NET Framework 3.5. The service will be hosted in a Windows Service environment. You need to create a Windows Service class that instantiates a service host. Which code segment should you use?

You are creating a Windows Communication Foundation service by using Microsoft .NET Framework 3.5. The service will be hosted in a Windows Service environment. You need to create a Windows Service class that instantiates a service host. Which code segment should you use?

A.
public class WindowsExamService : ServiceController
{
private ServiceHost serviceHost;
public new void Start()
{
serviceHost=new ServiceHost(typeof(ExamService));
serviceHost.Open();
}
}

B.
public class WindowsExamService : ServiceHostBase
{
private ServiceHost serviceHost;
public new void Open()
{
serviceHost=new ServiceHost(typeof(ExamService)); serviceHost.Open();
}
}

C.
public class WindowsExamService : ServiceBase
{
private ServiceHost serviceHost;
protected override void OnStart(string[] args)
{
serviceHost=new ServiceHost(typeof(ExamService)); serviceHost.Open();
}
}

D.
public class WindowsExamService : ServiceHost
{
private ServiceHost serviceHost;
public new void Open()
{
serviceHost=new ServiceHost(typeof(ExamService)); serviceHost.Open();
}
}



Leave a Reply 0

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