5

I'm trying to install windows service using the Microsoft.Sdc.Tasks library.

<ControlService Action="Install"
    ServiceName="Service1"
    User="XXX
    Password="XXX"
    ServiceExePath="$(DeployFolder)\XXX.exe"/>

But I keep getting prompted for the user and password! This will not work as I'd like to have it as an automated build on the build server. I mean, the user and password that I want to run the service under are in the actual target. How do I get it to install the service using the configured user and password and not prompt for it?

GEOCHET
  • 21,119
  • 15
  • 74
  • 98
Riri
  • 11,501
  • 14
  • 63
  • 88

2 Answers2

4

Found this post and since all my service does is writing and reading from local file I should be OK running under the Local Service account instead of a specific user. Even after updated the service installer the ControlService-target requires a user and password to run but then I actually doesn't prompt me for the user and password. But then I don't want to run a specific user and the target fails when not provided with a user and password in the config ... Strange.

I solved by shelling out to the InstallUtil.exe instead. That works fine after set the I set service installer to run as a Local Service account.

<Exec WorkingDirectory="C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727"
            Command="InstallUtil.exe -i XXX.exe" />
Riri
  • 11,501
  • 14
  • 63
  • 88
  • 1
    This will only install the service on the build server. If you want to install it to a remote server, you should use the servicecontroller task from here: http://weblogs.asp.net/scottgu/archive/2006/02/12/438061.aspx – Peter Walke Jul 09 '09 at 15:31
2

Just an FYI, to install to a remote server, you should use the SericeController task listed here:

http://weblogs.asp.net/scottgu/archive/2006/02/12/438061.aspx

Peter Walke
  • 2,497
  • 6
  • 33
  • 50
  • 2
    The ServiceController task doesn't allow services to be installed. It just controls installed services. – MikeD Dec 03 '09 at 13:53