views:

818

answers:

2

Imagine I create a .bat file in the following directory:

\trunk\Samples\PubSub\

@ECHO OFF
ECHO installing Subscriber 1
Subscriber1\bin\Debug\NServiceBus.Host.exe /install
pause
ECHO installing Subscriber 2
Subscriber2\bin\Debug\NServiceBus.Host.exe  /install
pause
ECHO starting Subscriber services
net start Subscriber1.EndPointConfig_v1.0.0.0
net start Subscriber2.EndPointConfig_v1.0.0.0
pause

I get prompted for a username and password, but using my own credentials I get an exception as follows:

An exception occurred during the Install phase. System.ComponentModel.Win32Exception: The account name is invalid or does not ex ist, or the password is invalid for the account name specified

  1. what credentials can I pass to get this to work?

  2. can I configure credentials as command line arguments to NServiceBus.Host.exe or run as 'Local System Account'?

Note:

My research so far suggests that (2) may be something that TopShelf supports via it's IInstallationConfiguration

I'm doing this on a Vista machine with MSMQ installed already.

The PubSub sample runs as expected if I just run the subscriber instances as console apps (i.e. like this):

@ECHO OFF
ECHO starting Subscriber 1
Subscriber1\bin\Debug\NServiceBus.Host.exe NServiceBus.Integration
pause
+1  A: 

(2.) can I configure credentials as command line arguments to NServiceBus.Host.exe or run as 'Local System Account'?

After digging around in TopShelf and NSB source code I discovered that this is pretty simple:

For anyone who's interested - this is something the TopShelf implements with IRunnerConfigurator.RunAsLocalSystem. NServiceBus calls this method if you add the marker interface ISpecify.ToRunAsLocalSystem

So the answer is to add ISpecify.ToRunAsLocalSystem to the list of interfaces implemented by the EndpointConfig class.

I didn't find an answer to:

(1.) what credentials can I pass to get this to work?

But now I don't really need one now as I'm happy enough to run the services as Local System.

rohancragg
rohancragg
I have a similar problem: I want to run as LocalSystem, but if I omit the username/password, the installer pops up a username/password dialog. Not sure if this is something new or not. Any idea what I can do about this?
Dmitri Nesteruk
A: 

I'm not sure if this is relevant but Matt Burton added the following commit recently:

I've yet to try it but my question (1) may now be irrelevant.

rohancragg