다음을 통해 공유


SPIisWebSite.ServerBindings property

Gets or sets a list of server bindings that are served by the Internet Information Services Web site.

Namespace:  Microsoft.SharePoint.Administration
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)

Syntax

'Declaration
Public Property ServerBindings As String()
    Get
    Set
'Usage
Dim instance As SPIisWebSite
Dim value As String()

value = instance.ServerBindings

instance.ServerBindings = value
public string[] ServerBindings { get; set; }

Property value

Type: []
A string array that contains the list of server bindings.

Remarks

A SPServerBinding object is a string that IIS uses to determine which network endpoints are used by the server instance. Use an indexer to return a single server binding from the collection. The string format is IP: Port: Hostname.

Examples

This example instantiates an SPIisWebSite object to access the server bindings for the local SharePoint Foundation farm. If there is neither an IP address nor a hostname for the SPIisWebSite object, that portion of the string that represents the server bindings is null.

[C#]

SPSite oSiteCollection = new SPSite("https://localhost");
Uri uri = new Uri(oSiteCollection.Url); 
SPWebApplication webApp = SPWebApplication.Lookup(uri);
int instID = webApp.IisSettings[SPUrlZone.Default].PreferredInstanceId;
SPIisWebSite iisWebSite = new SPIisWebSite(instID);
Console.WriteLine("*>>> SPIISWebsite Instance Id " + iisWebSite.InstanceId);
Console.WriteLine("*>>> Server Bindings          " + iisWebSite.ServerBindings);
string [] sb = iisWebsite.ServerBindings;
foreach (string strServerBinding in sb) {
  Console.WriteLine("Binding is " + strServerBinding);
}

See also

Reference

SPIisWebSite class

SPIisWebSite members

Microsoft.SharePoint.Administration namespace

Other resources

Setting Server Bindings Using System.DirectoryServices