I have created a windows service and installed it on 3 computers in a network.
It works fine on 2 of them but it has problem with the third one.
I have used Event Log to find out where the problem is, however it inserts logs just for the first time that i restart the system and also i have found that it just performs InitializeComponent() command in its constructor.
Note: My service should insert the login and logout of all accounts in a network and needs 3 dependencies that they start successfully before my service starts.
Edit:
I have followed this article to create my service.The following code is just the constructor of the service.
ComAdminCatalogClass comAdmin = new ComAdminCatalogClass();
ICatalogCollection subCollection;
//Service Constructor
Public Service1()
{
try
{
EventLog.WriteEntry("Service1","1");
InitializeComponent();
EventLog.WriteEntry("Service1","2");
subCollection = (ICatalogCollection)comAdmin.GetCollection("TransientSubscriptions");
SubScribToEvent(subCollection, "Logon");
SubScribToEvent(subCollection, "Logoff");
}
catch (Exception exp)
{
EventLog.WriteEntry("Service1",exp.Message);
}
}
Thanks a lot @akton, I have found the solution by run the exe of my service!!
It was too foolishly.The Event Viewer of the third system was full!!! I cleared all logs from it and my service works fine now in all three systems.
You can follow these steps to clear all Events