RunAs A different user when debugging in Visual Studio

后端 未结 7 1024
有刺的猬
有刺的猬 2020-11-29 05:21

I\'m trying to run the program I\'m debugging as a different user. Now, this can be done by running the exe and attaching from Visual Studio, but this is cumbersome.

7条回答
  •  一生所求
    2020-11-29 06:03

    You can open your command prompt as the intended user:

    • Shift + Right Click on Command Prompt icon on task bar.
    • Select (Run as differnt user)

    • You will be prompted with login and password

    • Once CommandP Prompt starts you can double check which user you are running as by the command whoami.

    • Now you can change directory to your project and run

    dotnet run

    • In Visual Studio hit Ctrl+Alt+P (Attach to Process - can also be found from Debug menu)

    • Make sure "Show Processes from All users" is checked.
    • Find the running process and attach debugger.

提交回复
热议问题