SPGlobalAdmin.SetAdminPort method
NOTE: This API is now obsolete.
若要變更 「 管理 」 網站的連接埠號碼,更新SPIisSettings物件關聯之管理由SPAdministrationWebApplication.Local,所傳回的 Web 應用程式和通話SPWebApplication類別之Provision方法。(在Windows SharePoint Services 2.0SetAdminPort方法設定的連接埠號碼的系統管理虛擬伺服器)。
Namespace: Microsoft.SharePoint.Administration
Assembly: Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Syntax
'宣告
<ObsoleteAttribute("To change the port of the administration site, update the SPIisSettings associated with SPAdministrationWebApplication.Local and call SPWebApplication.Provision().", _
False)> _
Public Sub SetAdminPort ( _
nPort As Integer, _
bSsl As Boolean _
)
'用途
Dim instance As SPGlobalAdmin
Dim nPort As Integer
Dim bSsl As Boolean
instance.SetAdminPort(nPort, bSsl)
[ObsoleteAttribute("To change the port of the administration site, update the SPIisSettings associated with SPAdministrationWebApplication.Local and call SPWebApplication.Provision().",
false)]
public void SetAdminPort(
int nPort,
bool bSsl
)
參數
nPort
Type: System.Int3232 位元整數,會指定的連接埠號碼。
bSsl
Type: System.Boolean使用指定的 Secure Sockets Layer (SSL) 通訊協定true ;否則,請false。
備註
除非是單一執行緒公寓 (STA) 執行緒,使用SetAdminPort方法並不會更新開始] 功能表中的連結。
Examples
下列範例顯示如何使用SetAdminPort方法。如果這個方法不是可行的將應用程式必須建立新的執行緒,並將ApartmentState屬性設定為STA,第一個範例所示。
如果程式碼正在執行中編製 ASPX 頁面上,在頁面指示詞ASPCompat屬性必須設定為TRUE— 例如, <%@Page ASPCompat="TRUE"%>。
Public Class Admin
<STAThread()>
Public Shared Sub Main()
Dim globalAdmin As New SPGlobalAdmin()
globalAdmin.SetAdminPort(8080, False)
End Sub 'Main
End Class 'Admin
public class Admin
{
[STAThread]
public static void Main()
{
SPGlobalAdmin globalAdmin = new SPGlobalAdmin();
globalAdmin.SetAdminPort(8080, false);
}
}
Public Class Admin
Dim setAdminPortThread As New Thread(New ThreadStart(AddressOf SetAdminPort))
setAdminPortThread.ApartmentState = ApartmentState.STA
setAdminPortThread.Start()
setAdminPortThread.Join()
Public Sub SetAdminPort()
Dim globalAdmin As New SPGlobalAdmin()
Try
globalAdmin.SetAdminPort(2003, False)
Finally
globalAdmin.Close()
End Try
End Sub 'SetAdminPort
End Class 'Admin
public class Admin
{
Thread setAdminPortThread = new Thread(new ThreadStart(SetAdminPort));
setAdminPortThread.ApartmentState = ApartmentState.STA;
setAdminPortThread.Start();
setAdminPortThread.Join();
public void SetAdminPort()
{
SPGlobalAdmin globalAdmin = new SPGlobalAdmin();
try
{
globalAdmin.SetAdminPort(2003, false);
}
finally
{
globalAdmin.Close();
}
}
}