如何使用“网络服务”启动控制台应用程序? 帐户?

发布于 2024-07-11 02:39:40 字数 229 浏览 6 评论 0原文

我有一个控制台应用程序,我想作为“NT AUTHORITY\NetworkService”运行,但我不记得如何执行此操作 - 唯一的原因是我将在 Windows 服务中托管我的服务,但用于 Kerberos 身份验证测试 我想使用域中已有的(服务主体名称)SPN(它确实启用了委派)。

简而言之,我可以简单地将其从控制台应用程序转换为 Windows 服务,但我希望避免这种情况。

我怎样才能做到这一点?

I have a console application that I would like to run as 'NT AUTHORITY\NetworkService', but I can't remember how to do so - the only reason is that I will be hosting my service in a Windows service, but for Kerberos authentication testing I want to use the (Service Principal Name) SPN that is already at the domain (it does have delegation enabled).

In short, I can simply convert it from a console application to a Windows service, but I was hoping to keep from that.

How can I do this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

二智少女猫性小仙女 2024-07-18 02:39:40

我不知道它有多准确,但建议这可能是不可能的 - 请参阅此处

将其移植到服务中可能是最简单的...出于调试目的,编写既可以作为服务也可以作为控制台 exe 工作的代码相当容易(使其易于调试,尽管身份错误)。 我一直这样做...

这是一个例子; 在代码中搜索开关:

case "-c": 
case "-console":

即使用“-c”,它直接运行代码,而不是启动服务基础设施。 该代码还展示了如何让 exe 作为自安装程序,这非常方便。

I don't know how accurate it is, but it is suggested that this might not be possible - see here.

It might be simplest to port it into a service... for debugging purposes, it is fairly easy to write code that can work either as a service or as a console exe (making it easy to debug, albeit in the wrong identity). I do this all the time...

Here's an example of this; search in the code for the switches:

case "-c": 
case "-console":

i.e. with "-c", it runs the code directly, rather than starting the service infrastructure. The code also shows how to have the exe act as a self-installer, which can be very handy.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文