Export (0) Print
Expand All

Binding Class

IIS 7.0

Represents the binding instructions for a Web site.

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

'Declaration
Public Class Binding _
	Inherits ConfigurationElement
'Usage
Dim instance As Binding

The Binding type exposes the following members.

  NameDescription
Public propertyAttributesGets a configuration attribute collection that contains the list of attributes for this element. (Inherited from ConfigurationElement.)
Public propertyBindingInformationGets or sets the binding information for the current binding.
Public propertyCertificateHashGets or sets the hash of the certificate to bind.
Public propertyCertificateStoreNameGets or sets the name of the certificate store.
Public propertyChildElementsGets all the child elements of the current element. (Inherited from ConfigurationElement.)
Public propertyElementTagNameGets the XML tag name of the current element. (Inherited from ConfigurationElement.)
Public propertyEndPointGets the IP endpoint of the binding.
Public propertyHostGets the host value of the binding.
Public propertyIsIPPortHostBindingGets a value indicating whether the binding is bound to an IP port.
Public propertyIsLocallyStoredGets a value indicating whether the configuration element is stored in a particular configuration file. (Inherited from ConfigurationElement.)
Public propertyItemGets or sets an attribute with the specified name. (Inherited from ConfigurationElement.)
Public propertyMethodsGets a collection of methods for the configuration element. (Inherited from ConfigurationElement.)
Public propertyProtocolGets or sets the protocol the binding will use.
Public propertyRawAttributesGets the raw attribute names and values for the current configuration element. (Inherited from ConfigurationElement.)
Public propertySchemaGets the schema for the current element. (Inherited from ConfigurationElement.)
Public propertyUseDsMapperGets or sets a value indicating whether the binding will use Active Directory mapping.
Top

  NameDescription
Public methodDelete (Inherited from ConfigurationElement.)
Public methodEquals (Inherited from Object.)
Protected methodFinalize (Inherited from Object.)
Public methodGetAttributeReturns a ConfigurationAttribute object that represents the requested attribute. (Inherited from ConfigurationElement.)
Public methodGetAttributeValueReturns the value of the specified attribute. (Inherited from ConfigurationElement.)
Public methodGetChildElement(String)Returns a child element that is under the current configuration element and has the specified name. (Inherited from ConfigurationElement.)
Public methodGetChildElement(String, Type)Returns a child element that is under the current configuration element and has the specified name and type. (Inherited from ConfigurationElement.)
Public methodGetCollection()()()()Returns the default collection for the current configuration element. (Inherited from ConfigurationElement.)
Public methodGetCollection(String)Returns all configuration elements that belong to the current configuration element. (Inherited from ConfigurationElement.)
Public methodGetCollection(Type)Returns the configuration element that has the specified type and is under the current configuration element. (Inherited from ConfigurationElement.)
Public methodGetCollection(String, Type)Returns the configuration element that has the specified name and type and is under the current configuration element. (Inherited from ConfigurationElement.)
Public methodGetHashCode (Inherited from Object.)
Public methodGetMetadataReturns metadata values from the element schema. (Inherited from ConfigurationElement.)
Public methodGetType (Inherited from Object.)
Protected methodMemberwiseClone (Inherited from Object.)
Public methodSetAttributeValueSets the value of the specified attribute. (Inherited from ConfigurationElement.)
Public methodSetMetadataSets metadata values from the element schema. (Inherited from ConfigurationElement.)
Public methodToStringReturns a string representation of the binding object. (Overrides Object..::..ToString()()()().)
Top

Site bindings specify the possible protocols and endpoints that are available for applications that are running on a Web site. A binding specifies how clients and IIS Manager communicate. There can be multiple bindings for any site. 

You can view the bindings for a site in the Site Bindings dialog box in IIS Manager. To open the dialog box, right-click a site node in the Connections pane, and then click Edit Bindings. The Site Bindings dialog box displays the Binding objects in the BindingCollection object for the site.

The following example gets and displays the bindings for each site.

Protected Overrides Sub OnActivated(ByVal initialActivation As Boolean)
    MyBase.OnActivated(initialActivation)
    If initialActivation Then
        Me.InitializeComponent()
        Me._serviceProxy = DirectCast(MyBase.Connection.CreateProxy(MyBase.Module, GetType(TestDemoModuleServiceProxy)), TestDemoModuleServiceProxy)
        '' Get the site collection on this server.
        Dim siteCollection As SiteCollection = Me._serviceProxy.GetSiteCollection
        Dim collectiondisplay As String = Nothing
        collectiondisplay = ("There are " & siteCollection.Count.ToString & " sites:" & ChrW(10) & ChrW(10))
        Dim sitedisplay As String = Nothing
        Dim site As Site
        For Each site In siteCollection
            sitedisplay = String.Concat(New Object() {sitedisplay, site.Name, ": ID= ", site.Id, ChrW(10)})
            '' Display each property of each bindings.
            Dim bindingdisplay As String = Nothing
            Dim binding As Binding
            For Each binding In site.Bindings
                bindingdisplay = (bindingdisplay & "  Binding:" & ChrW(10) & "   BindingInformation: " & binding.BindingInformation)
                If (binding.Protocol = "https") Then
                    '' There is a CertificateHash and  
                    '' CertificateStoreName for the https protocol only.
                    bindingdisplay = String.Concat(New Object() {bindingdisplay, ChrW(10) & "   CertificateHash: ", binding.CertificateHash, ": "})
                    '' Display the hash.
                    Dim certhashbyte As Byte
                    For Each certhashbyte In binding.CertificateHash
                        bindingdisplay = (bindingdisplay & certhashbyte.ToString & " ")
                    Next
                    bindingdisplay = (bindingdisplay & ChrW(10) & "   CertificateStoreName: " & binding.CertificateStoreName)
                End If
                bindingdisplay = (bindingdisplay & ChrW(10) & "   EndPoint: " & binding.EndPoint)
                bindingdisplay = (bindingdisplay & ChrW(10) & "   Host: " & binding.Host)
                bindingdisplay = (bindingdisplay & ChrW(10) & "   IsIPPortHostBinding: " & binding.IsIPPortHostBinding)
                bindingdisplay = (bindingdisplay & ChrW(10) & "   Protocol: " & binding.Protocol)
                bindingdisplay = (bindingdisplay & ChrW(10) & "   ToString: " & binding.ToString)
                bindingdisplay = String.Concat(New Object() {bindingdisplay, ChrW(10) & "   UseDsMapper: ", binding.UseDsMapper, ChrW(10) & ChrW(10)})
            Next
            sitedisplay = (sitedisplay & bindingdisplay)
        Next
        collectiondisplay = (collectiondisplay & sitedisplay & ChrW(10))
        Me.testLabel.Text = collectiondisplay
    End If
End Sub


Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Community Additions

ADD
Show:
© 2014 Microsoft