


There you can check your Service's log by start and stop the service.To upgrade to Windows 11, you need enough space on your hard drive for the installation to take place. Now write the command in CommandPromt as follows: C:\TimerService\TimerService\bin\Debug>net start service_name Note: -i is for install he service and -u for Unsinstall.Īfter -i set the write the path where you want to install your service. Now write the following command: C:\Windows\Microsoft.NET\Framework64\v9>InstallUtil.exe -i C:\TimerService\TimerService\bin\Debug\TimerService.exe Now, You have to open CommandPromt as Administrator.Īfter open, set directory to where your InstallUtil.exe file is placed.įor ex: C:\Windows\Microsoft.NET\Framework64\v9. Select option Run this program as an administrator. Than click on Change Settings For All Users. Than open Properties of your service_name.exe file. NOTE: goto bin\Ddebug folder of your project folder. Remove static void main method from Program.cs file. than right-click on serviceProcessInstaller1 and change its property value of Account from User to Local System. than right-click and select Add Installer. Right-Click on service_name.cs file and open designer of service. Protected override void OnStart(string args)ĮventLog.WriteEvent("Timer_Service", new EventInstance(0, 0, EventLogEntryType.Information), new string ) Timer_Service service = new Timer_Service() Public partial class Timer_Service : ServiceBase Than copy following code into your service_name.cs file. Open Visual studio and select new project by selecting Windows Service template in Windows Desktop tab.
