I'm trying to debug as NT AUTHORITY\SYSTEM. I've tried to use the methods described in the following question:
RunAs A different user when debugging in Visual Studio
Yet, what credentials do I need to use in order to pass through authentication?
runas cannot start as System/Local Service/Network Service etc. But psexec -s can start a process as System.
-s Run the remote process in the System account.
In my case, I was attempting to debug a web application using Visual Studio. Running Visual Studio using psexec -s -i didn't work for me, because the SYSTEM account did not have IIS Express configured.
What did work for me, however, was to rebuild my app (in debug mode), publish it to my local folder (in debug mode) where my IIS web app was pointing to it and then configure the apppool to run as the LocalSystem account.
I then launched the web application to initialize the web process. After initializing the web process, I would attach my Visual Studio debugger to the process:
Debug -> Attach to Process (Ctrl + Alt + P) -> Show processes from all users (checkbox)
Then select and attach to the process:
Related
I need to debug an applicaion.exe during its starup and the application resides on remote computer. If the application resides in a local system we can configure debugging properties of visual studio solution and use debugin->start new instance option to debug. Is there a way to connect to remote debugger and debug the remote process during its startup in visual stduio?
I have given the path remote details in the above properties but . when I start debugging(I am starting a new instance of the exe configured in the above picture to start debugging) the debugger exits because it cannot connect to remote debugger? Is there a way to achieve this?
ّFollow these steps:
Run remote debugger in the remote server
In visual studio debugger properties, select "remote windows debugger" in "debugger to launch" option
Provide command ad arguments
4 mention the IP and port in "remote server name"
I have been using IIS express as my web server for awhile now, but I've run into a scenario where I need the application pool to run as a specific user, rather than NetworkService or some other account.
Using the commands below, I created an app pool and configured the site to use it. Now, I'm unable to launch IIS Express as through Visual Studio. When I try, I get the "Visual Studio is unable to launch the IIS Express Web Server" message. If I use the command line to launch IIS Express, everything appears to work. If I change the app pool back to using a service account, or even just change the site to use a different app pool, things work just fine. Any ideas?
commands used to create the app pool
appcmd add apppool /name:MyPool /managedRuntimeVersion:v4.0 /managedPipelineMode:Integrated
appcmd set config /section:applicationPools /[name='MyPool'].processModel.identityType:SpecificUser /[name='MyPool'].processModel.userName:'MyUser' /[name='MyPool'].processModel.password:MyPass
appcmd set app /app.name:MySiteName/ /applicationPool:MyPool
command used to launch iisexpress.exe manually
iisexpress /config:c:\users\me\documents\iisexpress\config\applicationHost.config /trace:error
I've tried reinstalling both IIS Express and Visual Studio 2010 SP1. No difference.
Just an idea: since the problem is likely to be security-related, I'd suggest trying to run Visual Studio in elevated mode (Run as Admin). Or use IIS instead of Express, if you can.
Did you take look at how to run iisexpress app pool under a different identity
By default iisexpress.exe runs as current logged on user. If the above given link does not work, probably you should launch visual studio as desired user (use 'runas' command) and then automatically iisexpress.exe would run as whatever identity VS is running.
When a windows service is setup its run under a default network service logon. If I am debugging a windows service project from Visual Stduio, what logon credentials does it use? Also is there anyway to impersonate some other credentials when debugging this service from visual studio 2010?
Hi there Silverlight Student,
You can easily debug a Windows service using Visual Studio and there are multiple ways to do it.
One way you can do it is start the windows service, and then go to the debug menu in visual studio, and then choose Attach To Process. You'll find your service in the list, and double click on that. Then you can trap break points, trace, and everything in the debugger. Depending on how you start the process, that will affect the user account it runs under.
A second way, is you can set your service so it can also be started by command line and even open up a console window. I explain how to do that, with sample code here:
C# Windows Service: The service did not respond to the start
If you want to have the service run in a particular user context, you can go into the Windows Service Control Manager and configure what user your service runs as, then start it from there, and then use the attach to process approach to hook on using the debugger.
David
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)
I'm creating a WinForms application in Visual Studio 2008.
I want to run my application in the debugger and I want the application to run as a user other than the user running Visual Studio. What is the best way to do this?
If you have access to an OS that lets you have multiple terminal server sessions open, then simply open a new terminal server session as that user. With an administrator account running Visual Studio you should be able to debug the process in the other session.
You could add calls to your app to login as the desired user, but that isn't ideal since the environment is clearly not identical to the experience of running as that user.
Otherwise I think you need to look at remote debugging scenarios where VS is installed on a separate box.