This is just to help people troubleshoot the ArgumentOutOfRangeException problem when trying to install a windows service with installutil. It took me a good while to understand the reason of the install failure and I could not find anything about this
on the web concerning this problem, so hopefully this will help others in the future so they don't waste as much time as I did.
If you get:
An exception occurred during the Install phase.
System.ArgumentOutOfRangeException: Index and length must refer to a location within the string.
Parameter name: length
Then:
1) Go to the deisgner of your ProjectInstaller
2) Select the ServiceProcessInstaller
3) Go to the properties of the ServiceProcessInstaller.
4) If you see Account property set to user, change it to LocalSystem.
5) Rebuild your project.
6) Rerun installutil YourService.exe
Then the exception should be gone and the installation successful.
HTH
Sylvain Boissé Software Architect Noesis Innovation www.noesisinnovation.net