1 Apr, 2007
Dot Net Interview Questions
- Explain Windows service.
You often need programs that run continuously in the background. For example, an email server is expected to listen continuously on a network port for incoming email messages, a print spooler is expected to listen continuously to print requests, and so on.
- What’s the Unix name for a Windows service equivalent?
Daemon.
- So basically a Windows service application is just another executable? What’s different about a Windows service as compared to a regular application?
Windows services must support the interface of the Service Control Manager (SCM). A Windows service must be installed in the Windows service database before it can be launched.
- How is development of a Windows service different from a Windows Forms application?
A Windows service typically does not have a user interface, it supports a set of commands and can have a GUI that’s built later to allow for easier access to those commands.
- How do you give a Windows service specific permissions?
Windows service always runs under someone’s identity. Can be System or Administrator account, but if you want to restrict the behavior of a Windows service, the best bet is to create a new user account, assign and deny necessary privileges to that account, and then associate the Windows service with that new account.
- Can you share processes between Windows services?
Yes.
- Where’s Windows service database located?
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services
- What does SCM do?
SCM is Windows Service Control Manager. Its responsibilities are as follows:
- Accepts requests to install and uninstall Windows services from the Windows service database.
- To start Windows services either on system startup or requested by the user.
- To enumerate installed Windows services.
- To maintain status information for currently running Windows services.
- To transmits control messages (such as Start, Stop, Pause, and Continue) to available Windows services.
- To lock/unlock Windows service database.
- When developing a Windows service for .NET, which namespace do you typically look in for required classes?
System.ServiceProcess. The classes are ServiceBase, ServiceProcessInstaller, ServiceInstaller and ServiceController.