views:

503

answers:

4

I have developed a windows service and this is service is running on my local computer under my account. When I try to debug this service by attaching this as a process in visual studio 2008 I get “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.” I have logged in to my system as administrator and so when VS 2008 is launched it is running as administrator not sure why I get this error. I am using Windows XP Pro sp3

A: 

I have seen this on Vista, but not on XP. To counter this in Vista, I just right-click the Visual Studio 2008 entry in my start menu, and choose "Run as Administrator"

Raj More
I have logged in to my system as administrator and so when VS 2008 is launched it is running as administrator. Tired "Run as Administrator" and still get the same error.
A: 

Sounds like a couple of different things. First, check what user the process is running under, most likely admin or a domain admin. Change that to something less priviledged.

Also, it might be that you are connected to a domain and the domain admins have neutered the local administrator priviledges. In that case you need to get the IT department to fix this.

Chris Lively
The process is running under my logged in account. And i have Admin priveleges for my local system.
+1  A: 

If you're using Windows XP, the local security policy of the PC may be restricting non-administrators from running debuggers. By default, only administrators can debug.

Administrative tools -> Local Security Policy -> Local Policies -> User Rights Assignment -> "Debug programs"

spoulson
The process is running under my logged in account. And i have Admin priveleges for my local system. So I should inherit debug privelleges.
Domain Administrators frequently push down GPOs that restrict what can be done on local machines. An admin on the local machine does not necessarily translate to unlimited powers in certain conditions.
Raj More
A: 

Spoulson is correct, uless you have the SeDebugPrivilege in your logon token, you can't debug a process runing as a service. To check, I use ProcesExp.exe from the SysInternals suite by double clicking the Visual Studio process and checking the Security tab. On the bottom you will see all privileges you have been tranted. They start with a "Se" prefix.

Another thought would be to ensure you have all the JIT (Just In Time), debugger settings enabled under the Tools->Options->Debugger menu option in VS (Visual Studio for those who don't know).

  • Rashad Rivera Omegus Prime, LLC
Rashad Rivera