Error Message
Unable to attach to the process. Visual Studio has insufficient privileges to debug this process. To debug this process, Visual Studio must be run as an administrator.
Explanation
I use Visual Studio 2019 on a Windows 10 maschine
and installed via PowerShell de Service and start the service.
PowerShell command was:
New-Service -Name "ServiceName" -BinaryPathName D:\Project\ServiceName.exe
I try also with credentials:
$credential = Get-Credential --> Enter credentials
New-Service -Name "ServiceName" -BinaryPathName D:\Project\ServiceName.exe -Credential $credential
But if I try to attach the Service into Visual Studio 2019 (Run as an administrator) I get the message "Unable to attach..." (see ErrorMessage)
If I installed the service without credentials, I see the entry SYSTEM in the column username in Visual Studio. And with credentials DOMAINNAME\username [administrator]
Why is [administrator] appended at the end?
Do I not have enough rigths on my maschine?
I work on a virtual maschine Windows 10 environment.
Other Settings
Configuration: Local Security Policy --> Logal Policies/User Rights Assignment/Debug programs --> set my Domain
Local Security Policy --> Local Policies/Network access: Sharing and security model for local accounts --> Classic
Try on Debug|AnyCPU and Debug|x86