Issue when remotely debugging a web service
I've found this question many times on Google and on StackOverflow, though none answer my scenario.
I'm trying to remotely debug a web service, remote debugging is set up correctly, I've deployed the latest build (along with pdb files) and attached the debugger to the w3wp process on the remote machine. Once attached however, all of my break points are automatically disabled (Breakpoint will not currently be hit. No symbols have been loaded for this document). Does anyone know what I am doing wrong?
I've tried the following so far:
- set 'Generate Debug Information' to 'FULL' in advanced compile options.
- set 'Enable Optimisations' to 'False' in advanced compile options.
- In the Modules window the symbol status is 'Skipped loading 开发者_如何转开发symbols
- tried loading symbols manually
- tried changing symbol file locations in symbol settings to the remote pdb file
- cleaned and rebuild the solution before deployment
- I tried unchecking 'Just My Code' in the debugging options, that appeared to solve the problem, but when I called the web service, no break points were hit.
- This site looked promising, but didn't help in the end
- the pdb is on the remote machine
After much messing around I seemed to have achived what I wanted:
- in advanced compile options
- set 'Generate Debug Information' to 'FULL'.
- set 'Enable Optimisations' to 'False'.
- Ensure symbol file locations (debug - modules window) in symbol settings point to the correct location
- I added the remote location and the local location to the .pdb locations
- cleaned and rebuild the solution before deployment
I've never found a sure fire way to get this to work. When attempting to debug a WCF service hosted in IIS, following the same process over and over (ReBuild, Deploy, Restart Site, Attach) I would sometimes have the symbols loaded, sometimes not.
In my case, it came down to whether I attached to the process before somebody made a request against the site after I had deployed (in turn causing IIS to compile and do its funky stuff).
I found that if I followed these steps, it worked for me:
- Rebuild Solution
- Deploy to Remote Server
- Restart IIS - I doubt this is necessary, restarting the app pool would suffice I'm sure
- Locate the Worker Process and Attach to it - Breakpoints will be disabled at this point, that was fine
- Request something from the site - I did this just using a browser. This caused IIS to compile my app. By having VS attached prior to this compile, I found I was getting the symbols loaded (at least much more often than before).
Maybe the same process will work for you?
In my case, I had the pdb's deployed to the iis worker process path, so all was supposed to be good, and I really couldn't see why "Skipped loading symbols" was appearing. I really got the impression it just was not in the mood (no rational reason).
So i right clicked on the dll I was interested in debugging (can select multiple files also), and chose Load Symbols From > Symbol Path
and that caused them to be loaded.
Then I could debug it. Thanks!
精彩评论