Binding 类

定义

表示网站的绑定说明。

public ref class Binding : Microsoft::Web::Administration::ConfigurationElement
public class Binding : Microsoft.Web.Administration.ConfigurationElement
type Binding = class
    inherit ConfigurationElement
Public Class Binding
Inherits ConfigurationElement
继承

示例

以下示例获取并显示每个站点的绑定。

_serviceProxy = (TestDemoModuleServiceProxy)
    Connection.CreateProxy(Module, typeof(TestDemoModuleServiceProxy));

// Get the site collection on this server.
SiteCollection siteCollection = _serviceProxy.GetSiteCollection();
string collectiondisplay = null;
collectiondisplay = "There are " + siteCollection.Count.ToString() + " sites:\n\n";
string sitedisplay = null;
foreach (Site site in siteCollection)
{
    sitedisplay = sitedisplay + site.Name + ": ID= " + site.Id + "\n";
    // Display each property of each bindings.
    string bindingdisplay = null;
    foreach (Microsoft.Web.Administration.Binding binding in site.Bindings)
    {
        bindingdisplay = bindingdisplay + "  Binding:\n   BindingInformation: " + 
            binding.BindingInformation;
        if (binding.Protocol == "https")
        {
             // There is a CertificateHash and  
             // CertificateStoreName for the https protocol only.
            bindingdisplay = bindingdisplay + "\n   CertificateHash: " + 
                binding.CertificateHash + ": ";
            // Display the hash.
            foreach (System.Byte certhashbyte in binding.CertificateHash)
            {
                bindingdisplay = bindingdisplay + certhashbyte.ToString() + " ";
            }
            bindingdisplay = bindingdisplay + "\n   CertificateStoreName: " + 
                binding.CertificateStoreName;
        }
        bindingdisplay = bindingdisplay + "\n   EndPoint: " + binding.EndPoint;
        bindingdisplay = bindingdisplay + "\n   Host: " + binding.Host;
        bindingdisplay = bindingdisplay + "\n   IsIPPortHostBinding: " + binding.IsIPPortHostBinding;
        bindingdisplay = bindingdisplay + "\n   Protocol: " + binding.Protocol;
        bindingdisplay = bindingdisplay + "\n   ToString: " + binding.ToString();
        bindingdisplay = bindingdisplay + "\n   UseDsMapper: " + binding.UseDsMapper + "\n\n";
    }
    sitedisplay = sitedisplay + bindingdisplay;
}
collectiondisplay = collectiondisplay + sitedisplay + "\n";
testLabel.Text = collectiondisplay;

注解

网站绑定指定可用于网站上运行的应用程序的可能协议和终结点。 绑定指定客户端和 IIS 管理器的通信方式。 任何站点都可以有多个绑定。

可以在 IIS 管理器的“ 站点绑定 ”对话框中查看站点的绑定。 若要打开对话框,请右键单击“ 连接 ”窗格中的站点节点,然后单击“ 编辑绑定”。 “ 网站绑定 ”对话框显示 Binding 网站的 对象中的 BindingCollection 对象。

属性

Attributes

获取包含此元素的属性列表的配置属性集合。

(继承自 ConfigurationElement)
BindingInformation

获取或设置当前绑定的绑定信息。

CertificateHash

获取或设置要绑定的证书的哈希。

CertificateStoreName

获取或设置证书存储的名称。

ChildElements

获取当前元素的所有子元素。

(继承自 ConfigurationElement)
ElementTagName

表示网站的绑定说明。

(继承自 ConfigurationElement)
EndPoint

获取绑定的 IP 终结点。

Host

获取绑定的主机值。

IsIPPortHostBinding

获取一个值,该值指示绑定是否绑定到 IP 端口。

IsLocallyStored

获取一个值,该值指示配置元素是否存储在特定的配置文件中。

(继承自 ConfigurationElement)
Item[String]

获取或设置具有指定名称的属性。

(继承自 ConfigurationElement)
Methods

获取配置元素的方法集合。

(继承自 ConfigurationElement)
Protocol

获取或设置绑定将使用的协议。

RawAttributes

表示网站的绑定说明。

(继承自 ConfigurationElement)
Schema

获取当前元素的架构。

(继承自 ConfigurationElement)
SslFlags

表示网站的绑定说明。

UseDsMapper

获取或设置一个值,该值指示绑定是否将使用 Active Directory 映射。

方法

Delete()

表示网站的绑定说明。

(继承自 ConfigurationElement)
GetAttribute(String)

返回一个 ConfigurationAttribute 对象,该对象表示请求的属性。

(继承自 ConfigurationElement)
GetAttributeValue(String)

返回指定特性的值。

(继承自 ConfigurationElement)
GetChildElement(String)

返回当前配置元素下且具有指定名称的子元素。

(继承自 ConfigurationElement)
GetChildElement(String, Type)

返回一个子元素,该子元素位于当前配置元素下,具有指定的名称和类型。

(继承自 ConfigurationElement)
GetCollection()

返回当前配置元素的默认集合。

(继承自 ConfigurationElement)
GetCollection(String)

返回属于当前配置元素的所有配置元素。

(继承自 ConfigurationElement)
GetCollection(String, Type)

返回具有指定名称和类型的配置元素,并且位于当前配置元素下。

(继承自 ConfigurationElement)
GetCollection(Type)

返回具有指定类型且位于当前配置元素下的配置元素。

(继承自 ConfigurationElement)
GetMetadata(String)

从元素架构返回元数据值。

(继承自 ConfigurationElement)
SetAttributeValue(String, Object)

设置所指定特性的值。

(继承自 ConfigurationElement)
SetMetadata(String, Object)

设置元素架构中的元数据值。

(继承自 ConfigurationElement)
ToString()

返回绑定对象的字符串表示形式。

适用于