简体   繁体   English

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

[英]How can i start a console application using the 'network service' account

I have a console application that i would like to run as 'NT AUTHORITY\\NetworkService', but i cant 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 spn that is already at the domain (it does have delegation enabled) 我有一个控制台应用程序,我想运行'NT AUTHORITY \\ NetworkService',但我不记得如何这样做 - 唯一的原因是我将在Windows服务中托管我的服务,但对于kerberos身份验证测试我想要使用已经在域中的spn(它确实已启用委派)

In short i can simply convert it from a console app to a windows service, but i was hoping to keep from that. 简而言之,我可以简单地将它从控制台应用程序转换为Windows服务,但我希望保持这一点。

Does anyone know how to do this? 有谁知道如何做到这一点?

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). 将它移植到服务中可能是最简单的...出于调试目的,编写可以作为服务或作为控制台exe工作的代码相当容易(使其易于调试,尽管标识错误)。 I do this all the time... 我一直这样做......

Here's an example of this; 这是一个例子; search in the code for the switches: 在代码中搜索交换机:

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

ie with "-c", it runs the code directly, rather than starting the service infrastructure. 即使用“-c”,它直接运行代码,而不是启动服务基础结构。 The code also shows how to have the exe act as a self-installer, which can be very handy. 该代码还显示了如何使exe作为自安装程序,这可以非常方便。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何访问同一网络上的计算机并启动服务? - How can i access machine on same network and start a service? 如何在不输入用户帐户密码的情况下启动 Windows 服务? - How can I start the Windows Service without entering the user account password? 如何使用 c# 以编程方式安装系统服务以使用组托管服务帐户 (gMSA)? - How can I programmatically install a system service using c# to use a Group Managed Service Account (gMSA)? 我可以在自定义用户下启动.Net控制台应用程序吗? - Can i start .Net Console Application under custom user? 使用Process.Start时如何隐藏控制台应用程序用户界面? - How do I hide a console application user interface when using Process.Start? 有没有一种方法可以使用网络服务帐户将Windows C#应用程序连接到SQL Server - Is there a way to connect Windows C# Application to SQL Server using a Network Service Account 如何使用服务帐户将 .net 应用程序连接到数据库 - how to connect a .net application to database using service account 我如何自动启动Windows服务 - How can i start windows service automatically 如何从控制台应用程序返回值到.NET中的服务? - How do I return a value from a console application to a service in .NET? 如何以编程方式从另一个.Net项目启动和停止.NetCore API Server项目; 在这种情况下,控制台应用程序? - How can I programmatically start and stop a .NetCore API Server project from another .Net project; in this instance, a console application?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM