When debugging an old project using Attach to process I got the following error message
EXECUTE permission denied on object 'sp_sdidebug', database 'master', owner 'dbo'.
I checked the project properties, and only the ASP.NET debugger option was checked. A bit of a search around the internet found lots of different suggestions. But, the one that actually worked was one I found amongst this forum post which basically gives a solution of:
  • Choose the menu option Debug -> Attach to Process
  • In the Attach to Process dialog look in the Attach to: section, if it says "Automatic Native code", then click on Select and choose Managed and Native
  • Select the aspnet_wp.exe process
  • Press Attach

I can now happily debug. Yay!