共用方式為


<add> Element for connectionManagement(網路設定)

在連線管理清單中新增 IP 位址或 DNS 名稱。

<configuration>
  <system.net>
    <connectionManagement>
      <add>

語法

<add
  address="address expression"
  maxconnection="integer"
/>

屬性和項目

下列章節說明屬性、子元素和父元素。

Attributes

Attribute 說明
address 一個描述 IP 位址或 DNS 名稱的字串。
maxconnection 伺服器上允許的最大連線數。 如果沒有提供,預設是 2。

子元素

沒有。

父項目

元素 說明
連線管理 指定與網路主機的最大連線數。

備註

屬性的值 address 應以星號表示所有連接,或為形式 <schema>://<idn_hostname>[:<port>]為 的字串。

如果傳遞給任何 HTTP API 的 URI 包含 Unicode,名稱會在內部 DnsSafeHost 轉換,可能會回傳 punicode 字串(行為依目前 IDN 設定而定)。

組態檔

此元素可用於應用程式設定檔或機器設定檔(Machine.config)。

Example

以下範例設定應用程式使用四條連線至伺服器 www.contoso.com 及兩條連接至所有其他伺服器。

<configuration>
  <system.net>
    <connectionManagement>
      <add address="http://www.contoso.com" maxconnection="4" />
      <add address="*" maxconnection="2" />
    </connectionManagement>
  </system.net>
</configuration>

另請參閱