SPGlobalAdmin.SetAdminPort-Methode
HINWEIS: Diese API ist veraltet.
Zum Ändern der Portnummer der Website für die aktualisieren Sie SPIisSettings -Objekt, das die zurückgegebene SPAdministrationWebApplication.LocalVerwaltungswebanwendung zugeordnete, und rufen Sie die Provision -Methode der SPWebApplication -Klasse. (In Windows SharePoint Services 2.0 festlegen die SetAdminPort -Methode die Portnummer für den virtuellen Server der Zentraladministration.)
Namespace: Microsoft.SharePoint.Administration
Assembly: Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Syntax
'Declaration
<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 _
)
'Usage
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
)
Parameter
nPort
Typ: System.Int32Eine 32-Bit-Ganzzahl, die Portnummer angibt.
bSsl
Typ: System.Booleantrue an dieses Protokoll Secure Sockets Layer (SSL) wird verwendet. andernfalls false.
Hinweise
Mithilfe der SetAdminPort -Methode aktualisiert nicht den Link Start im Menü, es sei denn, der Thread ein Thread Single-Thread des Apartmentthreading (Station) ist.
Beispiele
Die folgenden Beispiele zeigen, wie Sie die SetAdminPort -Methode verwenden. Wenn diese Vorgehensweise nicht möglich ist, muss die Anwendung erstellen einen neuen Thread und legen Sie die ApartmentState -Eigenschaft auf STAwie im ersten Beispiel.
Wenn der Code in einer ASPX-Seite ausgeführt wird, muss das ASPCompat -Attribut in der Seitendirektive auf TRUEfestgelegt sein – beispielsweise <%@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();
}
}
}