Windows Service Wix installer does not install for Local Service account
- Dominant language
- No language data
- Stars
- 4.8k
- Forks
- 6.1k
- Avg merge
- 15h 21m
- Merged PRs (30d)
- 370
Description
### Type of issue
Typo
### Description
The only way I was able to my service .msi to install was to define the account NT AUTHORITY\LocalService
Otherwise, it said I had insufficient permission. I asked co-pilot and it gave me the right answer.
I think this documentation should be updated to reflect the correct values for Account
Copilot response
You’re right in the middle of the WiX 4 service‑installation rabbit hole, and the FireGiant page you have open gives the key detail you need: LocalService must be specified as a fully qualified account name. WiX doesn’t “magically” know the built‑in accounts unless you format them exactly the way Windows expects.
Here’s the distilled, practical version tailored to what you’re doing.
🛠️ Using the LocalService Account in WiX 4
The ServiceInstall element requires a fully qualified account name when you specify the Account attribute. The FireGiant docs confirm this:
“Fully qualified names must be used even for local accounts, e.g.
.\\LOCAL_ACCOUNT.”
For built‑in service accounts, Windows uses special names:
Built‑in Account | Correct WiX Account= Value
-- | --
Local System | LocalSystem
Local Service | NT AUTHORITY\\LocalService
Network Service | NT AUTHORITY\\NetworkService
So for LocalService, the correct value is:
Account="NT AUTHORITY\LocalService"
No password is required because LocalService has none.
✔️ Example WiX 4 Snippet
<Component>
<File Source="MyService.exe" />
<ServiceInstall
Id="MyService"
Name="MyService"
DisplayName="My Service"
Description="Does important things"
Type="ownProcess"
Start="auto"
ErrorControl="normal"
Account="NT AUTHORITY\LocalService" />
<ServiceControl
Id="StartMyService"
Name="MyService"
Start="install"
Stop="both"
Remove="uninstall"
Wait="yes" />
</Component>
⚠️ Common Pitfalls You Avoid by Doing It This Way
Using
LocalServicealone → Windows rejects it; must be fully qualified.Using
.\\LocalService→ Incorrect; that format is for local user accounts, not built‑in service identities.Specifying a password → LocalService has none; including one breaks the install.
Trying to use LocalService with
shareProcess→ Works, but only if the service EXE supports it.
🧩 Bonus: Why WiX Requires the Full Name
Windows Installer doesn’t translate friendly names. It writes the account name directly into the Service Control Manager (SCM). SCM only accepts the canonical identity:
NT AUTHORITY\LocalService
That’s why WiX enforces the fully qualified form.
If you want, I can help you validate your full WiX component, check your service EXE for permissions issues, or walk through the MSI logging to confirm the account is being applied correctly.
### Page URL
https://learn.microsoft.com/en-us/dotnet/core/extensions/windows-service-with-installer?tabs=wix
### Content source URL
https://github.com/dotnet/docs/blob/main/docs/core/extensions/windows-service-with-installer.md
### Document Version Independent Id
83c4d805-1394-90b7-6def-cf809c33ae22
### Platform Id
f3bef20e-b614-2024-1a39-065883e8e13a
### Article author
@gewarren
### Metadata
* ID: e044209a-0802-07c0-7518-208967a3ef02
* PlatformId: f3bef20e-b614-2024-1a39-065883e8e13a
* Service: **dotnet-fundamentals**
[Related Issues](https://github.com/dotnet/docs/issues?q=is%3Aissue+is%3Aopen+83c4d805-1394-90b7-6def-cf809c33ae22)
Contributor guide
Assessment
This issue has not been assessed yet.