This also has a usefull tip for ASP and IIS.
Unfortunately, debugging custom code for SharePoint isn't as easy as just pressing F5 from inside of Visual Studio 2008--but debugging can be set up easily by following the basic steps below:
Determine the process id of your app pool.
Attach the Visual Studio debugger to the process.
Since this can be tricky to set up the first time, I'll walk you through the steps.