在 NServiceBus 中安装通用主机作为服务时,如何提供有效凭据? [英] When installing a Generic Host as a service in NServiceBus, how do I provide valid credentials?

查看:65
本文介绍了在 NServiceBus 中安装通用主机作为服务时,如何提供有效凭据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我在以下目录中创建了一个 .bat 文件:

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

\trunk\Samples\PubSub\

\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:

在安装阶段发生异常.System.ComponentModel.Win32Exception: 帐户名无效或不排除ist,或者密码对指定的帐户名无效

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. 我可以传递哪些凭据才能使其正常工作?

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

我可以将凭据配置为 NServiceBus 的命令行参数吗.Host.exe 还是作为本地系统帐户"运行?

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

注意:

到目前为止,我的研究表明 (2) 可能是 TopShelf 通过它支持的I安装配置

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

我正在一台安装了 MSMQ 的 Vista 机器上执行此操作.

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

如果我只是将订阅者实例作为控制台应用程序运行(即像这样),PubSub 示例会按预期运行:

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

推荐答案

(2.) 我可以将凭据配置为 NServiceBus.Host.exe 的命令行参数还是作为本地系统帐户"运行?

在深入研究 TopShelf 和 NSB 源代码后,我发现这非常简单:

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

对于任何感兴趣的人 - 这是 TopShelf 通过 IRunnerConfigurator.RunAsLocalSystem.如果添加标记接口 ISpecify.ToRunAsLocalSystem

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

所以答案是将 ISpecify.ToRunAsLocalSystem 添加到 EndpointConfig 类实现的接口列表中.

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

我没有找到答案:

(1.) 我可以通过什么凭据来使其工作?

但现在我真的不需要它了,因为我很高兴能够将服务作为本地系统运行.

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

这篇关于在 NServiceBus 中安装通用主机作为服务时,如何提供有效凭据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆