Click here to Skip to main content
15,881,413 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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
Updated 19-Apr-12 22:48pm
v2

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.
 
Share this answer
 
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.
 
Share this answer
 
Comments
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)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900