XLST TIMEOUTS

I’d like to cover XSLT timeouts within SharePoint 2010 – a fairly quick topic but one that may save you a ton of time if you run into the issue that I was having.  Say for example you have a Search Results web part or Search Refinements web part and you want to do something clever that requires a call to custom logic within your XSLT, which you can configure within the web part properties of either of these web parts. 
So you’ve developed your custom code and you’ve attached your debugger and you’re stepping through to make sure everything is kosher, but when you get back to your page it has timed out and you have the nice yellow screen of death.  Even without debugging, if you have logic that is complex enough to take more than a second to execute you still see an error page due to a timeout. 
What you are lucky enough to have stumbled upon is a preconfigured timeout period for XSLT execution within SharePoint 2010, which is set to a value of 1 second out of the box.  Now, normally this would be fine, but in the scenarios described above, it is anything but fine.  So what is a developer to do?
PowerShell!  Specifically, there are three lines that you must run in order to change the timeout value for running XSLTs (I’m setting mine to a timeout of 5 seconds) :
$farm = Get-SPFarm
$farm.XsltTransformTimeOut = 5 #Or any value, in seconds
$farm.Update()



Comments