简体   繁体   中英

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)

In short i can simply convert it from a console app to a windows service, but i was hoping to keep from that.

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). 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. The code also shows how to have the exe act as a self-installer, which can be very handy.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM