WIX ServiceInstall - setting the service to run under the NetworkService account

吃可爱长大的小学妹 提交于 2019-12-07 09:16:27

问题


I am trying to create a WIX installer to install my windows service to run under the NetworkService account and getting an Insufficient Priviledges error during the installation.

I found this post where someone seems to be experiencing the same problem but no real solution was offered:

http://n2.nabble.com/Re-WiX-users-Digest-Vol-40-Issue-129-td3782055.html

I'm sure someone must have acheived this previously and wondered if they'd be kind enough to share a code snippet?


回答1:


NOTE: The answer below is only relevant on the older builds of WIX and Windows at the time the question was raised. The current version of the WIX service credentials will work if you set the native "NT AUTHORITY" domain and "NetworkService" account (no space necessary now).


Original Answer:

The correct identity name is "NT Authority\Network Service" not "NT Authority\NetworkService". A space is required then it works.

Funny that the default "LocalSystem" works directly with WIX 3.5, but for other well known accounts you have to prefix with "NT Authority...", for example "LocalService" does not work either when used directly.

i.e. fix this with:

Account='NT Authority\Network Service'




回答2:


It seems a few remnants of a previously failed install were preventing me from removing and reinstalling with Account="NT Authority\NetworkService". All is well in the universe again.




回答3:


I had the following snippet working under Windows 8.1 FR, and Windows 2012R2 ENU. But using NT AUTHORITY\NETWORK SERVICE failed with the insufficied privileges error.

So, at least under recent systems you must use NT AUTHORITY\NETWORKSERVICE as documented in MSDN.

              <ServiceInstall Id="xserviceInstall" Name="$(var.xServiceid)" 
              DisplayName="$(var.xServiceid)" 
              Description="x service" Start="auto" Type="ownProcess"
              ErrorControl="ignore" 
              Account="NT AUTHORITY\NETWORKSERVICE" 
              Arguments="-w -N" Vital="yes" />



回答4:


I used customAction to find the user credentials are correct or not.

If user credentials are matches the account in the machine they want to install,I will allow them to proceed to next dialog(UI) other wise I will show another Dialog indicating the user that account not found.



来源:https://stackoverflow.com/questions/1606361/wix-serviceinstall-setting-the-service-to-run-under-the-networkservice-account

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!