Click here to Skip to main content
13,005,843 members (90,879 online)
Rate this:
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
Updated 19-Apr-12 22:48pm
Rate this: bad
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.
Rate this: bad
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.
garfield185 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 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 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 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
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170627.1 | Last Updated 23 Apr 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100