开发者

Debug while Impersonating Another Domain Account

开发者 https://www.devze.com 2023-02-27 10:46 出处:网络
Is it possible to debug a C# .NET 4 application, run unit tests, etc., using domain user credentials other than my own?I have several elevated permissions that the users and/or service accounts will n

Is it possible to debug a C# .NET 4 application, run unit tests, etc., using domain user credentials other than my own? I have several elevated permissions that the users and/or service accounts will not posses, and want to avoid skewing my tests and ultimately suffering from "it works on my machine" syndrome.

I specifically want to create a SqlConnection object that uses a domain service account, rather than my own. I must use a domain account, and not SQL Server account, to allow SQL Server to emit PEXEC calls to other hardware. (Sounds fun, eh?)

I am surprised the option to run debug/release as a different domain user is not already setting in the solution/project Debug properties panel. It seems like something that would be useful. Sure, I understand the security risks, but you have to admit tha开发者_如何学Got would be very useful in many cases.

Thanks in advance!


Possible duplicate of this question? (Using VSCommands addon)

Or this cheap way, from VBForums:

Create your executable, then using "Run As" execute it under the normal user's credentials. Once it starts, open an instance of VS and attach the debugger to it.

0

精彩评论

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

关注公众号