Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
Hi everybody.

I have migrated my software from VS2005 to VS2010, and XP to Win7, and when debugging my windows services, trying to attach to the process I get this error:

"Unable to attach to the process. Visual Studio has insufficient privileges to debug this process. To debug this process, Visual Studio must be run as an administrator."

So, I run it as an administrator, I checked the permission on VSLauncher.exe and devenv.exe to make it run always as an admin, but I still get the error.

I am an administrator already. Has anybody have this same problem?

BTW, I'm using W7, VS2010.
 
Also, running VS with right click and "Run as administrator" makes no difference.
Posted 19-Apr-12 4:55am
Edited 19-Apr-12 22:48pm
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

I solved this myself.
 
It was a permissions problem.
Win7 comes with a new security system, and I had to add to my profile (even being an admin) this permission:
 
Control panel -> Administrative tools -> Local Security policy -> Local Policies -> User rights Assignment -> Debug programs -> Add user or group .
 
And there, I added my own user. Reboot machine(Important!! Without rebooting, it won't work).
 
After that, I was able to attach processes to debug them. It's been a really long time to solve this, I hope to help other people that find this same problem.
 
Thanks everybody for your help.
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

I have seen this as well and even when I have the settings set for run always as an admin and my user is also an admin, I still need to right click and say to start as an administrator at times. Not sure why but launching with a right click and picking that other option has helped me.
  Permalink  
Comments
garfield185 at 19-Apr-12 11:09am
   
Thanks for your answer. I tried to open VS with right click and "Run as administrator". Open the solution, and try to debug, but it still says that I need Admin permission. It's weird because at the top of the window it says "Visual Studio 2010 (Administrator)" so it is actually opened as admin... :(
Steve Maier at 19-Apr-12 11:14am
   
That is weird. When I was debugging a service I actually had it launch in a console app instead of as a service so that u could break where I wanted easier.
garfield185 at 20-Apr-12 4:43am
   
Launch the service via console? I can start and stop it, but to debug it with VS2010 I must attach the code to the running process and that's when I get the "You must be admin" error. Any idea?
Steve Maier at 20-Apr-12 7:13am
   
What I had was the service was mainly in a separate dll and the code that was run in the service start was just called from the console app. This way I could start it in debug mode without having to attach to it as a service. For me this helped the debugging.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Your Filters
Interested
Ignored
     
0 Shai Vashdi 1,838
1 Tadit Dash 310
2 OriginalGriff 283
3 Sergey Alexandrovich Kryukov 260
4 Peter Leow 220
0 Sergey Alexandrovich Kryukov 9,440
1 OriginalGriff 5,618
2 Peter Leow 4,280
3 Maciej Los 3,540
4 Abhinav S 3,363


Advertise | Privacy | Mobile
Web04 | 2.8.140415.2 | Last Updated 23 Apr 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Use
Layout: fixed | fluid