KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I created a window service and to install it I created its deployment project and installed that. After installing I stared it. It successfully started. Next day I made some modification, and rebuild and reinstalled but now its not installing. Then I thought its issue with installer, lets create a custom installer for service so that anytime I can update my code. I created it like this incase if anyone need this for future. public class MyInstaller : Installer { ServiceProcessInstaller spi; ServiceInstaller si; public MyInstaller() { spi = new ServiceProcessInstaller(); spi.Account = ServiceAccount.LocalSystem; si = new ServiceInstaller(); si.StartType = ServiceStartMode.Manual; si.ServiceName = "MyService"; si.DisplayName = "My Service"; si.Description = "service installed from command line"; this.Installers.Add(spi); this.Installers.Add(si); } } I called it from main method by check the parameter args. case "-i": case "-install": ti = new TransactedInstaller(); mi = new MyInstaller(); ti.Installers.Add(mi); string logPath = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + "\\install.log"; ctx = new InstallContext(logPath, cmdline); ti.Context = ctx; //.Context ( ctx ); ti.Install(new Hashtable()); break; Now when I am trying to install. I recevied error System.Security.SecurityException: The source was not found, but some or all event logs could not be search
Tags (comma-separated)
Save Edits
Cancel