4

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 that would be very useful in many cases.

Thanks in advance!

Mike Christian
  • 1,526
  • 1
  • 15
  • 27

1 Answers1

6

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.

Community
  • 1
  • 1
dizzwave
  • 4,013
  • 1
  • 19
  • 16
  • Good catch. Normally wouldn't give an upvote to a duplicate link but since you have no rep to close, I'll get you started here. – Austin Salonen Apr 21 '11 at 17:41
  • woot, thanks! Yeah, it wouldn't even let me leave it as a comment.. I think I need a few more rep for that. – dizzwave Apr 21 '11 at 17:44