1. You go to install your service (installutil <path to your service executable>
Local Service has minimal privileges, and therefore is more secure to use than Network Service or Local System. There is no password for Local Service despite what it looks like in the image to the left.
I granted access for Local Service to the bin\Debug folder for my Windows service while testing.
2. You go to debug your Windows service, but it errors and quits before you can get to Visual Studio and attach to your Windows service process.
I ended up adding a Thread.Sleep(10000) in the Main() method right before the ServiceBase.Run() method is called. That seems to be enough time on my machine to open the Attach to Process dialog and then navigate to my Windows service.
Also, it is important that you are running your Visual Studio instance as administrator, or you won't have privileges to attach to your Windows service.
3. You uninstall your service and then attempt to re-install the service, but you get a message stating that the service has been marked for deletion. Once that happens, then you need to reboot your machine in order to install the service. I ran into that problem before, and wrote about it here, but the short version is that you should avoid having the "Services" application running while uninstalling/installing the service.
I'll add onto this post if I hit other generic issues while working on the Windows service.
I'll add onto this post if I hit other generic issues while working on the Windows service.
No comments:
Post a Comment