If window service is installed on the account above, it can not obtain the following path:
System.Environment.GetFolderPath (Environment.SpecialFolder.MyDocuments)
Solution:
1. Change the LocalSystem to user, then compile the installer and fill in the current login user's account information when installing.
Resources:
The Account property value of the ServiceProcessInstaller class can be any value of the Serviceacount enumeration, as shown in table 2
value |
|
|
Set this value to specify the user account for which the service uses high privileges on the local system, but this account allows anonymous users to enter the network. So it doesn't have permissions on the network |
& nbsp; This account type provides computer certificates to any remote server |
is similar to LocalService, which specifies that the computer's certificate is transferred to the remote server, but unlike LocalSystem, This service can be as a non-authorized user; Log on to the local system. As the name implies, this account can only be used for services that need access to resources from the network |
User |
Set the Account property to Serviceaccount.user, which means that you can specify the accounts that should be used in the service |
C#-windows service to LocalSystem mega you can't get my files path
.