# Debugging Problem with Sharepoint Foundation 2010

I've installed Sharepoint 2010 Foundation on my WS2008R2 copy... Whenever i lanch from Visual Studio some debug, the process couldn't attach to IIS and so every break point is skipped..

To male debugger work, i've gone to the folder

C:\inetpub\wwwroot\wss\VirtualDirectories\80


(The app I'm interested in is installed on the 80 port)

From that folder I change some parameters in the file web.config, as I found on the web:

 <customErrors mode="Off" />

<compilation batch="false" debug="true" optimizeCompilations="true">

<SafeMode MaxControls="200" CallStack="true" DirectFileDependencies="10" TotalFileDependencies="50" AllowPageLevelTrace="false">


With this config no breakpoint is considered, even if i run it with "F5 || Start Debugging"...

I don't know if this is important, but i'm trying to debug some methods that are on a Web Service (installed in my ISS on a couple of ASMX files)

Thank you very much!

-
Are you getting an error that it could not attach or is it merely skipping the breakpoints? –  Dave Wise Feb 13 '12 at 16:35
Merely skips breakpoints! Breakpoints seems to be "up", 'cause if I put the mouse on them the says "attached to process w3ws.exe" or something like that.. –  Ziba Leah Feb 13 '12 at 17:17

I have seen this behavior before when IIS is not cycled after VS builds and deploys to the GAC. In those cases, it is using a cached copy of the code and thus the breakpoints do not line up. An occasional IISReset will flush this through.

The other thing to try is manually attach to ALL W3WP.exe processes and see if it hits your breakpoints then. If it does, it means the F5 is attaching to the wrong process.

The last suggestion is to make sure that you are in the local Administrators group on your dev machine and that you are running Visual Studio as Administrator. Usually you will get other errors if either of these is not done but security is one of those gray areas where it never hurts to be sure.

-
As you suggested I close WS, and Launch it by Admin Role.. To the SP i log as Admin and Owner, so the problem couldn't be there... I attach TO all w3wp.exe processes and to all iexplore.exe active in my system... And launch debug... When i trigger my method from web interface of my Web Service nothing happens... =/ do you have something else to suggest me? thank you very much!! –  Ziba Leah Feb 13 '12 at 17:43
You might need to hit your web service manually via the browser before attaching the debugger to all W3WP.exe instances just to be sure that it is running –  Dave Wise Feb 13 '12 at 17:51
One other thing - are you simply building the solution or Deploying it? It needs to be deployed before it can be debugged –  Dave Wise Feb 13 '12 at 17:55
I'm deploying.. I have 4 asmx files.. 4 webservices..Every service works but only one debugs! –  Ziba Leah Feb 13 '12 at 18:32
Is it possible that the others are erroring out before it reaches your breakpoint? –  Dave Wise Feb 13 '12 at 18:54

I have found the best method to debug SharePoint is to use the Attach to Process option in VS. Attach to the w3wp process, and if there are multiple and you can't figure out which one to use, attach to all of them.

-