SharePoint 2010: Enabling Developer Dashboard on Anonymous Sites


Something I ran into awhile ago and spent way too long digging out is enabling developer dashboard.  “But Lefty, there are thousands of blog posts on this subject, are you dim?” you might ask.  Nay, just picky. Most of the time, nobody cares how the admin side of their application performs.  Normally if it’s slow, it only affects a few users.  And normally those users are either the person or a direct report of the person that contracted the creation of that application.  The slow, behemoth that is the admin side helps them further appreciate the nimbleness of the public side.  In my experience, the best way to transform that slow behemoth into a nimble speed demon is the developer dashboard, and a liberal application of SPMonitoredScopes.

So how does one enable the Developer Dashboard?  One disadvantage of the anonymous side is you lose your top ribbon.  Without that, you can’t turn the dashboard off and on at your beckon call.  So the easiest thing to do is force the developer dashboard to on:

$service = [Microsoft.SharePoint.Administration.SPWebService]::ContentService
$addsetting = $service.DeveloperDashboardSettings
$addsetting.DisplayLevel = [Microsoft.SharePoint.Administration.SPDeveloperDashboardLevel]::On 
$addsetting.Update()

You log into your admin side, and holy crap, it’s on.  GREAT!  You log into the anonymous side, and… what the?  It’s off!  This is bullcrap!  Patience young padawan.  The problem here is your anonymous users, and most likely, your authenticated users, don’t have the right permissions to view the dashboard.  So we have to ease the requirements and allow everybody to see it (this is only in your dev/QA environment, right?).

$service = [Microsoft.SharePoint.Administration.SPWebService]::ContentService
$addsetting =$service.DeveloperDashboardSettings
$addsetting.RequiredPermissions = [Microsoft.SharePoint.SPBasePermissions]::EmptyMask 
$addsetting.DisplayLevel = [Microsoft.SharePoint.Administration.SPDeveloperDashboardLevel]::On 
$addsetting.Update()

A quick IIS reset for good measure, view your anonymous website, and viola, the beautiful dashboard awaits.  This simple tool is your number one tool for analyzing misbehaving pages/webparts/lists/etc.  If you want even more information, throw this badboy in there:

$DeveloperDashboardSettings.TraceEnabled = $true;

After another IIS reset, you’ll be set for some tracing goodness that will give you the necessary information to tame the SharePoint beast.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s