Developer dashboard is a new feature provided since sharepoint2010. It is an information panel located at the bottom of the page, it can directly display the running time of each component on the current page, database calls generated by the running of the current page, each database call, and other information. For SharePoint website development, maintenance and debugging are very helpful.
Developer dashboard is disabled by default. You need to enable this function by yourself, but there is no out-of-the-box function in the SharePoint user interface for you to enable it, there are usually three ways to enable it, and once enabled, it will be effective throughout the farm.
1. Use the stsadm command
This command is used to set related values for the developer-Dashboard attribute.
Off: Disable
On: always open
OnDemand: the website administrator can choose to enable or disable it. In this way, the website administrator can choose to turn on or off the monitoring output of a specific website set, which will be used as a troubleshooting tool for specific groups of people.
Stsadm-O setproperty-PN developer-dashboard-PV off
Stsadm-O setproperty-PN developer-dashboard-PV on
Stsadm-O setproperty-PN developer-dashboard-PV OnDemand
2. Use powershell commands
Use the TXT editor to create a powershell PSL file named devedashboard. PSL and save it to c: \, devedashboard.CodeAs follows:
Write-host
Write-host " Loading powershell environment for Sharepoint " -Foregroundcolor green
Write-host
# Unload & load the SharePoint powershell snapin
$ Snapin = Get-pssnapin | Where - Object {$ _. Name-EQ
' Microsoft. Sharepoint. powershell ' }
If ($ Snapin-ne $ Null ){
Write-host " Unloading SharePoint powershell snapin... " -Foregroundcolor blue
Remove-pssnapin " Microsoft. Sharepoint. powershell "
Write-host " SharePoint powershell snapin unloaded. " -Foregroundcolor green
}
$ Snapin = Get-pssnapin | Where - Object {$ _. Name-EQ
' Microsoft. Sharepoint. powershell ' }
If ($ Snapin-EQ $ Null ){
Write-host " Loading SharePoint powershell snapin... " -Foregroundcolor blue
Add-pssnapin " Microsoft. Sharepoint. powershell "
Write-host " SharePoint powershell snapin loaded. " -Foregroundcolor green
}
Write-host " Enabling the developer dashboard... " -Foregroundcolor blue
$ Contentservice =
[Microsoft. Sharepoint. Administration. spwebservice]: contentservice
$ Dashboardsetting = $ contentservice. Configure dashboardsettings
$ Dashboardsetting. displaylevel =
[Microsoft. Sharepoint. Administration. spdeveloperdashboardlevel]: OnDemand
$ Dashboardsetting. Update ()
Write-host " Developer dashboard enabled. " -Foregroundcolor green
Open powershell in administrator mode and run it. The execution result is as follows:
3. Use Code
3.1 create a webpart to run the following code and deploy it on the central administration site (because the developer dashboard is a setting at the farm level)
You need to introduce Microsoft. Sharepoint. Administration namespace
Using System;
Using Microsoft. SharePoint;
Using Microsoft. Sharepoint. administration;
Namespace Enabledomaindashboard
{
Class Program
{
Static Void Main ()
{
Spdeveloperdashboardsettings settings = spwebservice. contentservice. descridashboardsettings;
Settings. displaylevel = spdeveloperdashboardlevel. on;
Settings. Update ();
}
}
}
3.2 Create a Console Based on. NET Framework 3.5ProgramAnd set the build to any CPU (because Sharepoint is x64 ). Execute the following code in the console program:
Spperformancemonitor perfmon = spfarm. Local. extends cemonitor;
Perfmon. Fig level = spperformancemonitoringlevel. on;
Perfmon. Update ();
When you open it in onmand mode, you can see an icon in the top-right corner of the website. You can use this icon to control the enabling and disabling of the developer dashboard.
4. Download existing feature to control developer-dashboard
Someone has developed a ready-made feature on the Internet. download it from (here). You can deploy it on administrator CENTREL, as shown in figure
Click it to go to the settings page as follows: