“Unable to attach to the process. Access is denied.”
Have you ever gotten this error while debugging a VS workflow by way of attach to process?

I get it whenever I debug my workflow! Let me explain. After making changes to my workflow code, I want to see what they do, so I build the solution, upgrade via the WSPBuilder context menu (available by right clicking the project), then Attach to Process, select w3wp.exe (attached to Workflow code) and bam it works.
After I stop the debug and for some reason I want to debug again (having made no changes to code, no rebuild, etc), I Attach to Process and get the above message! Whaaat???
SOLUTION (or what works for me):
Simply Copy to GAC from the WSPBuilder context menu, then Attach to Process and it should work!

Again, I am using WSPBuilder so the solution to this problem may be different if you aren’t using it.
Filed under: Visual Studio, Windows Workflow Foundation | 3 Comments
Tags: Debugging, Visual Studio, Workflow, WSPBuilder
This doesn’t always work. I’ve had the same issues with WSPBuilder. I’m trying to figure out why sometimes VS can attach to the process and other times it can’t. I’ve tried recycling the app pools, redeploying, etc. But no luck.
Dennis
You can also do a IISRESET to remove this error.
Resetting iis and restarting vs was a huge pain for me. What ended up working for me was in the attach to process modal when I chose w3wp.exe from the list of available processes, was to go back to select next to attach too and choose managed code. It seemed to stay managed code and it all works fine. It was set to workflow before.
Your millage may vary.