如何使用“网络服务”启动控制台应用程序? 帐户?
我有一个控制台应用程序,我想作为“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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不知道它有多准确,但建议这可能是不可能的 - 请参阅此处。
将其移植到服务中可能是最简单的...出于调试目的,编写既可以作为服务也可以作为控制台 exe 工作的代码相当容易(使其易于调试,尽管身份错误)。 我一直这样做...
这是一个例子; 在代码中搜索开关:
即使用“-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:
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.