SPS2010新增的一个功能是Developer Dashboard,一旦打开开关,系统会增加一个webpart在页面的底部
从中可以看到开发时必要的信息,例如那个环节花费了较多的时间。
用VB来打开这个开关
Imports System
Imports Microsoft.SharePoint
Imports Microsoft.SharePoint.Administration
Module Module1
Sub Main()
Dim ContentService As SPWebService = SPWebService.ContentService
Dim developerDashboard As New SPDeveloperDashboardSettings()
developerDashboard = ContentService.DeveloperDashboardSettings
developerDashboard.DisplayLevel = SPDeveloperDashboardLevel.On
developerDashboard.Update()
Console.WriteLine("Developer Dashboard UPdated!")
End Sub
End Module
用PowerShell
$snapin = Get-PSSnapin | Where-Object {$_.Name -eq 'Microsoft.SharePoint.Powershell'}
if ($snapin -eq $null)
{
Write-Host "Loading Microsoft SharePoint Powershell Snapin"
Add-PSSnapin "Microsoft.SharePoint.Powershell"
}
$dash = [Microsoft.SharePoint.Administration.SPWebService]::ContentService.DeveloperDashboardSettings;
$dash.DisplayLevel = [Microsoft.SharePoint.Administration.SPDeveloperDashboardLevel]::On;
$dash.Update();
Write-Host "Sucess" ;
用 STSADM
stsadm -o setproperty -pn developer-dashboard -pv On 或者
stsadm –o setproperty –pn developer-dashboard -pv OnDemand.
选择OnDemand 会在页面的右上角出现一个小小的按钮来控制developer dashboard的显示与否。