I’m trying to create a Windows Service in C# .NET, everything looks fine but when I install the service an exception raises, and I don’t know why this happen.
The Exception is this:
An exception occurred during the Install phase.
System.IO.IOException: The process cannot access the file ‘C:Program FilesMyFirstServiceMyFirstService.InstallState’ because it is being used by another process.
I made my research but I couldn’t find any information about this specific IOException.
I use the following command for install the service: "installutil.exe /i MyFirstService.exe"
If someone knows anything is a big help.
Source: Windows Questions