There could be too many reasons of the problem. In particular, it could be a matter of insufficient privileges.
To start investigation of the problem, give a Windows Service administrator's privileges. You can do it in your implementation of
ServiceProcessInstaller
, see
http://msdn.microsoft.com/en-us/library/system.serviceprocess.serviceprocessinstaller.aspx[
^].
If this change of account does not help, add detailed logging to the system Event Log using the class
System.Diagnostics.EventLog
, see
http://msdn.microsoft.com/en-us/library/system.diagnostics.eventlog.aspx[
^].
View the System Log using the applet event viewer:
%SystemRoot%\system32\eventvwr.msc /s
Try to find the point where the execution breaks. Use the debugger (you will need to attach it to the process of the Windows Server as you cannot start if in Visual Studio as it is designed to be hosted only by the Service Controller).
When and if you stuck again, ask another question, this time much more specific, with comprehensive issue report and code sample.
[EDIT]
Answering a follow-up question: read about using self-hosted WCF:
http://msdn.microsoft.com/en-us/library/ms731758.aspx[
^].
—SA