Thursday, March 8, 2012

Some best practices of developing SharePoint 2010 applications



Came across some nice videos on best practices from Ted Pattison. Here is the gist of what he suggests.

Development
  • Use Site template instead of the site definition. Hell during the upgrades from one version of SP to another.
  • Deploy the site templates as sandboxed solution in the staging/test environment to check out the bottlenecks and depending on the needs deploy them in production as sandboxed or farm based.
  • Use Feature Stapling. element to staple a feature to a site definition.
  • Version Features and anticipate for feature upgrades.
  • Hide the Features that have been stapled as hidden. Use the Visual studio properties windows to hide them. This ensures that they are not seen by the site admins.
  • Keep in mind about various cycles of Activation and Deactivation. Deactivation leaves behind the list instances and next time activations will break during the deployment. Ensure to write appropriate code to either delete or backup previous versions before deleting them.


Testing and Deployment.
  • Use the SPDisposeCheck utility sparingly.
  • Ensure to use the keyword using() especially to SPSite object to let the .net framework take care of the disposing. Do not dispose the SPSite object created by others that is received through the event receivers or anything like that. Ex: properties.parent.site
  • Test your environment without any SDKs installed. Probably a VM or something would be good. Keep your QA environment with at least two boxes. One for the Web/App and another for the DB Server.
  • Test your QA machines on debug mode to catch any unknown errors.
  • If you are deploying a farm based solutions prefer to use a script like PowerShell to install them.
  • Updates to web.config needs to be automated. For safe control entries you can add data to the manifest file. However for other entries use the SP Object model. See some methods of updating web.config http://msdn.microsoft.com/en-us/library/ms439965.aspx  / http://msdn.microsoft.com/en-us/library/bb861909.aspx








Sunday, March 4, 2012

Extending the debug session in SharePoint 2010


Error Message
The Web server process that was being debugged has been terminated by Internet Information Services (IIS). This can be avoided by configuring Application Pool ping settings in IIS. See help for further details.


Resolution
By default, the IIS application pool waits 90 seconds for an application to respond before it closes the application. This process is known as "pinging" the application. To resolve this issue, you can either increase the wait time or disable application pinging entirely.


To access the IIS app pool settings

  1. Open IIS Manager.
  2. In the Connections pane, expand the SharePoint server node and click Application Pools.
  3. On the Application Pools page, select the SharePoint application pool (typically "SharePoint - 80") and then, in the Actions pane, click Advanced Settings.
  4. To increase the wait time before IIS timeout, change the value of Ping Maximum Response Time (seconds) to a value larger than 90 seconds.
  5. To disable IIS pinging, set Ping Enabled to False.



for more information on the troubleshooting in SharePoint 2010 
http://msdn.microsoft.com/en-us/library/ee231594.aspx