Can you debug a webpart in a WSS page? Yes – not a problem.
- From WSPBuilder make your Webpart (WP). See here.
- Activate the feature containing the WP
- Add the WP to a site page
- Open the page in a browser
- In VisualStudio (VS) set a breakpoint in your WP code
- RightClick (RC) project – Build (Shift+F6)
- RC project – WSP – Copy2Gac
- (RC project – WSP – Recycle) => w3wp.exe will be shutdown and a new one will be created when a request to a page is done.
- RC project – WSP – Attach – choose w3wp.exe (the one with sql…?) => The breakpoint will be unfilled and not yet be reachable
- Refresh the browser (F5) => this will load debug info
- VS: Stop debugging (shift+F5)
- RC project – WSP – Attach – choose w3wp.exe
- Refresh the browser (F5) => now your breakpoint will be filled and reached
Thanx to Erik Norström.
In addition you would like to have following set in the web.config for your WebApp:
<?xml version="1.0"?> <configuration> <SharePoint> <SafeMode CallStack="true" AllowPageLevelTrace="true"> <PageParserPaths> </PageParserPaths> </SafeMode> </SharePoint> <system.web> <!-- Enable ASP.NET debugging. Set compilation debug="true" to insert debugging symbols into the compiled page. --> <compilation batch="false" debug="true"> </compilation> <!-- The <customErrors> section enables configuration of what to do if/when an unhandled error occurs during the execution of a request. --> <customErrors mode="Off"> </customErrors> </system.web> </configuration>