3

I started to use remote debugging for checking my web-service behavior which developed in ASP.NET (not MVC not .net core) but during debug process value of variables what not shown and watch was not working.

Many answers such as [1],[2] suggested to enable Use Managed Compatibility Mode. I did this but after this change I cannot connect to remote process anymore due to error: Unable to attach to the process. Access is denied. I should disable Use Managed Compatibility Mode to be able to attach to remote process again.

I don't know how to fix this although there are many suggestions such as Running as administrator and etc but they did not work. Details: MY IDE: VS 2019 Version 16.2.0 in windows 10x64 IIS Server runs on Windows 7x64 Both VS2019 and Remote Debugger ran as administrator.

enter image description here

VSB
  • 9,825
  • 16
  • 72
  • 145
  • Have you tried the last two suggestions [Here](https://social.msdn.microsoft.com/Forums/vstudio/en-US/57f1701c-1661-48b6-8ab2-a2b637615392/access-denied-when-trying-to-debug-remotely?forum=vsdebug)? – Dumisani Feb 13 '20 at 14:08
  • @Dumisani None of the helped. I could access process and attach to it before changing type to Managed however among two last tricks, I could not use 2nd trick – VSB Feb 16 '20 at 12:08
  • @VSB,were you able to solve this, if yes can you share how ? thanks – Clint Mar 05 '20 at 16:51

3 Answers3

1

I am not sure this will help but I will give my 2 cents here.

first make sure you have passed test settings enter image description here

once it is done, right click on the website in IIS -> Manage Website -> then browse this will create new instance in the processes(in case the instance was the issue).

now go ahead and attach the process for w3wp.exe, it should allow you to attach the process.

a couple threads I found may help you

  1. https://social.technet.microsoft.com/Forums/en-US/51f55fd6-bed7-412d-b410-d0ad4113f533/cannot-attach-debugger-to-miiserverexe?forum=identitylifecyclemanager
  2. https://learn.microsoft.com/en-us/visualstudio/debugger/unable-to-attach-to-the-process?view=vs-2019
Manjuboyz
  • 6,978
  • 3
  • 21
  • 43
1

During my research I noticed that, while many of the posts had recommended to try ManagedCompatibilityMode, there were others such as that suggests to disable it

For AccessDenied error:

  • Remote Debugger Monitor > Tools > Permissions > Check Allow Debug for the relevant users.
  • Debug Options > Debugging > General > JustInTime > Check Managed
  • Also a MSDN post on this UnableToAttachToProcess

For values not appearing in debug mode, I've put together the various checks you can perform

  • Ensure that Build Configuration is set to Debug (not release)
  • Properties > Build > Advance > Debug Info : Full
  • Build > Clean solution
  • Launch cmd > iisreset
  • Uncheck Optimize code
  • Check Unsafe code
  • Debug Options > Check Suppress JIT optimization on module

  • Publish Profile: Configuration set to Debug

  • Debug Options > Check "Enable just my code"
  • Debug > Options > Check Use legacy C# and VB expression evaluators (Uncheck it back, if it does not work)
  • Tools > Options > Debugging > Symbol > Click Empty Symbol Cache
  • Tools > Import and Export Settings > Reset All Settings
Clint
  • 6,011
  • 1
  • 21
  • 28
0

Do you choose “DefaultAppPool” while adding Web Site to IIS or others like “ASP .NET 4.0”? I notice that the type of w3wp.exe is “x86”, not sure if this matters, as I test on my side and it is x64(since MS stops support for Windows7, I use two machines with Windows 10 x64 and test on my side but the remote debugging works well).

Also, please make sure when you publish, you have set the configuration to “Debug”(not “release”). And note “debugging between two computers connected through a proxy is not supported.”, not sure if you missed something/steps, you could check this document: Remote Debug ASP.NET on a Remote IIS Computer to confirm it.

In addition, please check the “Permissions for Remote Debugging”(VS 2019 Remote Debugger(Administrator)=>Tools=>Permissions..) and make sure the administrator/user has been added to “Group or user names” and check the “Allow” checkbox under “Permissions for Administrators” for “Debug”.

Hope this could help you a little.

大陸北方網友
  • 3,696
  • 3
  • 12
  • 37