开发者

Can i start .Net Console Application under custom user?

I have a console application that i would like to run as 'MySpecificUser开发者_开发问答'. Can i specify this user in app.config?


No, you can't. By the time the config file is read by the CLR it is too late to specify the user the process runs under. On the other hand you could write a launcher console application in whose config file you specify a username and password which are used to run the actual application using for example this Process.Start overload.


You can use the runas utility in order to execute any program as a specific user.

This is not something you could specify in a config, however, not directly.


I don't think this is possible by editing the app.config.

You should rather use Process.Start in order to run the process under another user. You will need to provide a password for the user account otherwise it will not work.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜