Reputation: 24212
I have an application that is intended to run without admin rights, but it fails in that scenario. I tried to run my app as administrator, and it runs. But that's not what I want.
What I want is a way to debug my application without administrator privileges, so that I can determine what is causing it to fail when running as a normal user... so that I at least know what is the cause, and possibly make it in a way that runs without admin rights.
Whenever I run Visual Studio 2015, it starts with Administrator privileges. No way to get rid of that (Administrator)
in title bar:
I have tried runas /netonly /user:User devenv.exe
to no avail:
If I try to run VS2015 under another more restricted account, it say that it needs Administrative privileges, and does not run:
Clicking "Cancel the task ad return to Visual Studio" won't return to VS, instead it will close.
The problem is that when I run my application without admin privileges it does not open. No messages. Nothing. But when I try to debug it inside Visual Studio it runs... because VS itself only runs as administrator.
Is there a way to debug without admin rights?
Upvotes: 9
Views: 16367
Reputation: 31
It's an old post but I want to add my input as the solution in my case was a bit different and might help someone.
I had similar issue with Visual Studio 2019 using windows 10. When i pressed F5(debug), 'This task requires the application to have elevated permissions' message was prompted.
I tried many solutions recommended but didn't work for me. The issue was iisexpress.exe 'IIS Express Worker Process' setting was set to 'Run as Administrator'. I was trying to fix port binding issue and made some changes which i forgot to undo.
Run project in Visual Studio with Administrator permission and then Open task manager > Processes > expand Visual Studio 2019 node > right click on 'IIS Express Worker Process'> properties> Compatibility > uncheck Run as Administrator option
Upvotes: 1
Reputation: 15398
From one day to the other I faced the same issue with VS 2019.
Change ownership of the devenv.exe
(C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\devenv.exe
):
devenv.exe
> Properties Now Visual Studio is launched without administrator rights and therefore also the debugging.
Unfortunately, this must be done after every update.
Upvotes: 4
Reputation: 101
For additional info around this case.
I have quite restricted IT systems at work and normally my VS was starting without admin privileges. However, to allow me to install updates etc. I made a request to put my .exe in the list of softwares starting with admin privileges. That happened. Good for updating.
Therefore, I assume, there is not way how I may temporary start my VS without admin privileges.
I faced similar issue when tried to use Outlook Interop from console app with following code:
Outlook.Application application = null;
// Check whether there is an Outlook process running.
if (Process.GetProcessesByName("OUTLOOK").Count() > 0)
{
// If so, use the GetActiveObject method to obtain the process and cast it to an Application object.
application = Marshal.GetActiveObject("Outlook.Application") as Outlook.Application;
}
else
{
// If not, create a new instance of Outlook and log on to the default profile.
application = new Outlook.Application();
}
// Return the Outlook Application object.
return application;
I received following error when VS (and therefore my console app) was started with admin privileges but the Outlook was not:
System.Runtime.InteropServices.COMException (0x800401E3): Operation unavailable (Exception from HRESULT: 0x800401E3 (MK_E_UNAVAILABLE))
Then I tried to start the same code from debug folder directly by running .exe file and it worked properly.
Thanks for good hints.
Upvotes: 0
Reputation: 6436
So the issue is that it still opened the VS as the admin even if you just open the blank VS IDE in your side, am I right?
Please make sure that you don't enable "The program requires additional permissions" under Troubleshoot compatibility or the property settings for the VS IDE shortcut or the devenv.exe:
https://superuser.com/questions/547810/how-to-turn-off-always-run-as-administrator-windows-8
Upvotes: 1
Reputation: 13085
There is something wrong with your Visual Studio installation. It can for sure run without admin. However, you can work around this.
If your app fails very quickly this will of course not work, and you will instead need to look into your Visual Studio setup.
Upvotes: 3
Reputation: 315
If you right click on the shortcut and select properties, then select the shortcut tab, there is an advanced button. Click that and you can then select he application to not start in admin mode. Also, be aware that if you are using iis you will need VS to be running in admin mode to debug.
Upvotes: 2