Thursday, October 12, 2006

Troubleshooting Web Parts and Deployment

The Connection Model

Creating a Connectable Web Part {MSDN]

There are 11 high-level steps that you must complete to implement a connection interface for your Web Part:

Create the interface class.
Declare events.
Override the EnsureInterfaces method, and then call the RegisterInterface method.
Override the CanRunAt method.
Override the PartCommunicationConnect method.
Override the PartCommunicationInit method.
Override the PartCommunicationMain method.
Override the GetInitEventArgs method.
Implement the interface event handlers.
Override the RenderWebPart method.
Implement supporting methods.

Monday, October 02, 2006

Sharepoint: Enabling Remote Debugging

This whole process can pretty much be broken down into 3 steps:

Enable debugging on the server.
Enable debugging on the client.
Configure firewall (if running XP SP2)


Enable debugging on the Server

This is usually as simple as running the VS.Net install on the server and only installing the remote debugging components (make sure not to install FP extensions).
Add yourself to the “Debugger Users” group.
In the web.config, set
< SafeMode MaxControls="50" CallStack="true" />
< compilation batch="false" debug="true" />
< trust level="Full" originUrl="" />

Enable debugging on the client

For the project you wish to debug, go to Project | Properties. Under Configuration Properties | Debugging set
Enable Asp.Net Debugging to True
Set Debug Mode to URL
Set the start URL to the home page for your portal
Set Enable Remote Debugging to True
Set the Remote Debug Machine to the Netbios name of your SPS Server
Make sure that your portal machine is in the Trusted Sites group in IE
For the project you wish to debug, go to Project | Properties. Under Common Properties | Build Events, create a post build step to copy the assemblies and the pdb files to the server. Something like:
copy /y "$(TargetDir)$(ProjectName).pdb" R:\bin
copy /y "$(TargetPath)" R:\bin
{Note that we've mapped a drive on the server that points to the root of the portal site to our R: drive}
Make sure that the assembly that you want to debug is set as the Startup Project in Visual Studio (right-click the project and select “Set as Start-up Project“).

Configure Firewall (if running XP SP2)
Go to http://support.microsoft.com/?kbid=841177 and download the DebuggerFirewallConfiguration.exe utility.
Extract the files and then run debuggerFirewall.exe. This configures the client firewall such that it will allow you to debug to the remote server.