Need to debug process as a non admin (VS2010) - visual-studio

I am running the following
Win7 SP1 Enterprise
VS2010 Pro SP1
Non admin user
I need to attach to the w3wp.exe process
I have assigned myself debug privs via GPO
When attempting to attach to the process I get
Microsoft Visual Studio
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.
The main issue is I need to debug a site that handles multiple hostheaders (sitecore)
Cassini has no concept of hostheaders
IISExpress does not handle hostheaders - cannot launch site with different hostheaders*
Is there an alternative around this ?
Side note
I have tried to give myself admin token with the following as a test as well
http://www.scriptlogic.com/products/privilegeauthority/
VS launches as an 'admin' but gives me the whole Unable to attach to the process. Visual Studio has insufficient privileges to debug this process.
Side note 2
Using process explorer on devenv.exe doesn't show the SeDebugPrivilege enabled
I have tried using ntrights.exe to grant the rights - rebooted and still not there.

If you have an admin password you can (when you open VS) right click, and then say 'run as administrator', otherwise you just may be out of luck as far as I know.

This link here: Working with Web Projects in Visual Studio as a Non-Administrative User says it clearly:
You cannot attach to a process that is running under the IIS worker
process because it requires administrative privileges.

We ended up using http://www.scriptlogic.com/products/privilegeauthority/ granting the SeDebug Token as well.
This worked out well as we could also apply this to other products like ants profiler which needed admin rights to run (wasn't required for XP)

Related

Visual Studio 2005 Output file requires Administrative Privileges

Using Visual Source Safe 2005, I downloaded a jobmate's project in my computer and built it correctly, but when I press "play" to debug it I receive an error message telling me that I need higher privileges.
Looking around, I've noticed that the freshly build program has the little shield icon that means that I need administrator permission to run it and actually, if I run it outside Visual Studio, I manage to execute it after the UAC question.
I'm domain and local administrator so I can disable UAC, but I don't think this is the solution, so: what can make my program to require administrative privileges?

Why does the IIS application require elevated permissions to attach to?

I'm having this exact problem:
Visual Studio requires elevated permissions in Windows 7
But I'm not really happy with any of the answers there so I was wondering if someone could expand on an alternative solution.
Setup
dev box is running server 2008
Visual Studio 2010
IIS 7
In order to attach to a process running under IIS, I am being told I need to run Visual Studio as an administrator. If I do this, whenever I edit and check a file into source control the other users (who are not administrators) can't edit the file because the FILE now needs elevated permissions to edit! Causing massive headaches, so basically running VS as admin doesn't appear to be an option.
Does anyone have any alternatives?
Attaching to process which runs under different user credentials or higher integrity level requires SE_DEBUG privilege which application obtains when running as administrator. Your IIS AppPool is most likely not configured to run under your account hence the requirement for elevated permissions.
Starting from Windows Vista SE_DEBUG privilege is disabled for processes not running as admin (or more precisely, not running with high integrity level).
From MSDN:
Certain administrative Windows privileges can be assigned to an access
token only with at least a high integrity level. If the access token
integrity level is less than high, then specific administrative
privileges are not allowed and are removed from the access token. The
administrative privileges associated with a high integrity level are:
...
SE_DEBUG_PRIVILEGE
...
And fruther from here:
SeDebugPrivilege - Required to debug and adjust the memory of a
process owned by another account. User Right: Debug programs.
If you go to properties on your website project, then click on the 'web' tab, then choose the option 'Use local iis web server', you can then debug 'as normal'. That works for us without elevated permissions.
Bit late in the game here, but I've found if you install Remote Tools for Visual Studio and install it locally, you can then attach to w3wp.exe without having to run under elevated permissions!
To give this privilege
1) Run GPEDIT.MSC from command prompt.
2) Navigate to
Local Computer Policy -> Computer Configuration -> Windows Settings ->
Security Settings -> Local Policies -> User Right Assignment -> Debug
programs and add users to it.*
*You should also be aware of If you grant somebody SeDebugPrivilege, you gave away the farm
http://social.msdn.microsoft.com/Forums/en-US/0f394922-4d3d-4c00-8bc1-88aeeeedd843/how-to-add-a-user-to-debug-users-group?forum=netfxbcl
Update:
This not works too.
The alternative is, as describe on book "Professional Visual Basic 2012 and .NET 4.5 Programming": Go to the bin/debug folder and manually start the ProVB2012_Security.exe executable outside of debugger. But in either case you should now be prompted to grant administrator rights...

How to avoid necessity of Admin. privileges for Visual Studio with IIS or COM Interop?

When Visual Studio is run without admin. privileges and
I am registering .dll for COM interop the error message is:
Cannot register assembly "myassembly.dll" - access denied.
Please make sure you're running the application as administrator.
Access to the registry key 'HKEY_CLASSES_ROOT\' is denied.
I am running a web application on IIS the error message is:
The Web Application Project PSW is configured to use IIS.
To access local IIS Web sites, you must run Visual Studio
in the context of an administrator account.
I have set Visual Studio run as Administarator to avoid these errors. But UAC message annoys me (but I do not want to switch UAC off).
Is there a way to run Visual Studio normally and use COM Interop or IIS? I mean e.g. some access rights to registry or IIS or set regasm to run as admin.
UAC requires an application to split itself into standard user friendly parts, and admin only parts, and then you can request elevation only when admin only parts are needed (elevation on the fly).
However, the current Visual Studio releases, 2008, 2010, even 11 Beta are still monolithic (like a monolithic kernel, http://en.wikipedia.org/wiki/Monolithic_kernel). So it is impossible right now to achieve what you want, and you have to get used to what it is.
Some access rights to registry or IIS won't help, as you obviously considered too little about what Visual Studio is :) It is a much larger system relying on too many underlying bits.

Debug or build as non-admin in Visual Studio 2008

I am trying to install Visual Studio 2008 at a university's computer lab. The lab machines (XP Pro) are configured so that students don't have Administrator rights when they log in. So when I try to build or debug a class library project in Visual Studio 2008, I get this error: "Cannot register assembly 'C:\Documents and Settings(username)\My Documents\Visual Studio 2008\Projects\testproj\testproj\bin\Debug\testproj.dll' - access denied. Please make sure you're running the application as administrator. Access to the registry key 'HKEY_CLASSES_ROOT\test.cmdTest' is denied."
In previous versions of Visual Studio, there was the option to add the non-admin account to the Debugger Users and VS Developers groups, and this would enable them to debug and build DLLs. Does Visual Studio 2008 include similar functionality, and would this even be the solution? I'm not seeing the groups added with the installation. If this functionality is not included, is there another way to solve this issue? Allowing students to have Admin rights or Power User rights to the machines is out of the question.
Any suggestions, ideas, or insight would be much appreciated.
Why not just consider using some kind of virtualizations ? Install Visual Studio on a virtual machine, hence, every mess a student gonna make, is gonna be virtual to some extent.
Keep a ready and fresh copy of the image file though.
Probably not the answer you want, but you could start VS by right clicking VS2008/devenv.exe > "run as" and select administrator and have the lab tech enter the admin credentials. This way, VS2008 will have the required rights, but your school isn't giving out a sensitive Login/Password.
Your school should change the group policy to allow you to build your projects. Enlist the help of a friendly professor for that.
Are you doing a web application? I believe that for non-web applications, you do not need admin rights.
If this is not a web application, maybe it's just a file system permissions issue?
From:
http://msdn.microsoft.com/en-us/library/ms165100.aspx
"User permission requirements for Visual Studio vary depending on the operating system and the Visual Studio version. On Windows Vista, Visual Studio 2008 does not require administrator permissions to perform most tasks, but Visual Studio 2005 must run under administrator permissions to perform tasks correctly. On Windows Server 2003 and earlier, members of the Users group can perform most activities in the integrated development environment (IDE)."
It looks like you're trying to register the assembly in COM.
Access to the registry key
'HKEY_CLASSES_ROOT\test.cmdTest' is
denied."
Are you setting a [assembly:ComVisibleAttribute(true)] attribute in your assemblyinfo.cs or project properties? Try setting this to assembly:ComVisibleAttribute(false).

In Visual Studio you must be a member of Debug Users or Administrators to start debugging. What if you are but it doesn't work?

On my Windows XP machine Visual Studio 2003 2005 and 2008 all complain that I cannot start debugging my web application because I must either be a member of the Debug Users group or of the Administrators group. So, I am an Administrator and I added Debug Users just in case, and it still complains.
Short of reformatting my machine and starting over, has anyone encountered this and fixed it [with some undocumented command]?
Which users and/or groups are in your "Debug programs" right (under User Rights Assignment)? Maybe that setting got overridden by group policy (Daniel's answer), or just got out of whack for some reason. It should, obviously, include the "Debug Users" group.
We encountered an issue like this and found that it was a group policy issue. There's a group policy setting for debugging that needs to be enabled. It overrides the fact that you are in the right group.
You could try running "VsJITDebugger.exe -p <PID>" on the command line. I've had a simalar situation and been able to debug the application using the above.
"VsJITDebugger.exe /?" will show you all the options.
The PID can be found either in the task manager (view->Select Columns...) or Visual Studio's Attach to Process.
Awesome, I'd never really known about the "Administrative Tools -> Local Security Settings -> Local Policies -> User Rights Assignment" under XP. My "Debug programs" policy is set to "Administrators" only, yet trying to debug now just worked and this is several days after installing the .NET framework 3.5, so maybe that installation fixed things in the background.

Resources