共用方式為


<ws2007HttpBinding>

定義一種可互通的綁定,提供對正確版本 SecurityReliableSessionTransactionFlow 綁定元素的支援。

<組態>
   <system.service模型>
     <裝訂>
       <ws2007HttpBinding>

語法

<ws2007HttpBinding>
  <binding allowCookies="Boolean"
           bypassProxyOnLocal="Boolean"
           closeTimeout="TimeSpan"
           hostNameComparisonMode="StrongWildCard/Exact/WeakWildcard"
           maxBufferPoolSize="integer"
           maxReceivedMessageSize="Integer"
           messageEncoding="Text/Mtom"
           name="string"
           openTimeout="TimeSpan"
           proxyAddress="URI"
           receiveTimeout="TimeSpan"
           sendTimeout="TimeSpan"
           textEncoding="UnicodeFffeTextEncoding/Utf16TextEncoding/Utf8TextEncoding"
           transactionFlow="Boolean"
           useDefaultWebProxy="Boolean">
    <reliableSession ordered="Boolean"
                     inactivityTimeout="TimeSpan"
                     enabled="Boolean" />
    <security mode="Message/None/Transport/TransportWithCredential">
      <transport clientCredentialType="Basic/Certificate/Digest/None/Ntlm/Windows"
                 proxyCredentialType="Basic/Digest/None/Ntlm/Windows"
                 realm="string" />
        <message clientCredentialType ="Certificate/IssuedToken/None/UserName/Windows"
                 negotiateServiceCredential="Boolean"
                 algorithmSuite="Basic128/Basic192/Basic256/Basic128Rsa15/Basic256Rsa15/TripleDes/TripleDesRsa15/Basic128Sha256/Basic192Sha256/TripleDesSha256/Basic128Sha256Rsa15/Basic192Sha256Rsa15/Basic256Sha256Rsa15/TripleDesSha256Rsa15"
                 establishSecurityContext="Boolean" />
    </security>
    <readerQuotas maxArrayLength="Integer"
                  maxBytesPerRead="Integer"
                  maxDepth="Integer"
                  maxNameTableCharCount="Integer"
                  maxStringContentLength="Integer" />
  </binding>
</ws2007HttpBinding>

屬性和項目

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

Attributes

Attribute Description
allowCookies 一個表示用戶端是否接受 cookie 並在未來請求中傳播的值。 預設值為 false

你可以在與使用 cookie 的 Web 服務(ASMX)互動 ASP.NET 使用此特性。 這確保伺服器回傳的 Cookie 會自動複製到未來所有該服務的客戶端請求中。
bypassProxyOnLocal 一個表示是否要繞過代理伺服器取得本地位址的值。 預設值為 false
closeTimeout 一個 TimeSpan 指定密切操作完成時間間隔的值。 此值應大於或等 Zero於 。 預設值是 00:01:00。
hostNameComparisonMode 規定用於解析統一資源識別碼(URI)的 HTTP 主機名稱比較模式。 此屬性的型別 HostNameComparisonMode為 ,表示在 URI 匹配時是否使用主機名稱來存取服務。 預設值為 StrongWildcard,忽略了配對中的主機名稱。
maxBufferPoolSize 此綁定的最大緩衝池大小。 預設為 524,288 位元組(512 × 1,024)。 Windows 通訊基礎(WCF)的許多部分都使用緩衝區。 每次使用緩衝區都建立與銷毀它們成本高昂,緩衝區的垃圾回收也同樣昂貴。 使用緩衝池時,你可以從緩衝池中取一個緩衝區使用,完成後再歸還給緩衝池。 這樣可以避免建立和銷毀緩衝區的額外負擔。
maxReceivedMessageSize 以位元組計,包含標頭,由配置使用此綁定的通道可接收的最大訊息大小。 超過此限制的訊息發送者會收到 SOAP 錯誤。 接收端會丟棄訊息,並在追蹤日誌中建立事件的條目。 預設是 65536。
messageEncoding 定義用於編碼訊息的編碼器。 有效的數值包括以下幾項:

- Text:使用簡訊編碼器。
- Mtom:使用 Message Transmission Organization Mechanism 1.0(MTOM)編碼器。

預設值為 Text

此屬性的類型 WSMessageEncoding為 。
name 綁定的配置名稱。 這個值應該是唯一的,因為它是用來識別裝訂的。 從 .NET Framework 4 開始,綁定和行為不再需要名稱。 欲了解更多關於預設設定及無名綁定與行為的資訊,請參閱簡化設定與簡化配置(Simplified Configuration for WCF Services)。
openTimeout 一個 TimeSpan 指定開啟操作完成所需時間區間的值。 此值應大於或等 Zero於 。 預設值是 00:01:00。
proxyAddress 一個指定 HTTP 代理位址的 URI。 若 useSystemWebProxytrue則此設定必須為 null。 預設值為 null
receiveTimeout 一個 TimeSpan 指定接收操作完成所需時間區間的值。 此值應大於或等 Zero於 。 預設值是 00:01:00。
sendTimeout 一個 TimeSpan 指定傳送操作完成所需時間間隔的值。 此值應大於或等 Zero於 。 預設值是 00:01:00。
textEncoding 指定用於在綁定上發送訊息的字元集編碼。 有效的數值包括以下幾項:

- UnicodeFffeTextEncoding: Unicode 大恩序編碼。
- Utf16TextEncoding: 16位元編碼。
- Utf8TextEncoding: 8位元編碼。

預設值為 Utf8TextEncoding

此屬性的類型 Encoding為 。
transactionFlow 一個指定綁定是否支援流動 WS-Transactions 的值。 預設值為 false
useDefaultWebProxy 一個指定系統自動設定的 HTTP 代理是否被使用的值。 預設值為 true

子專案

元素 Description
<安全> 定義綁定的安全設定。 此元素的類型 WSHttpSecurityElement為 。
<讀者配額> 定義了端點可處理 SOAP 訊息複雜度的限制,這些端點可透過此綁定來處理。 此元素的類型 XmlDictionaryReaderQuotasElement為 。
<可靠會話> 規定通道端點間是否建立可靠的會話。

父項目

元素 Description
<裝訂> 此元素包含標準與自訂裝訂的集合。

備註

WS2007HttpBinding 新增了系統 WSHttpBinding 提供的綁定,類似於結構化資訊標準促進組織(OASIS)標準版本的 ReliableSession、Security 和 TransactionFlow 協議。 使用此綁定時,不需要更改物件模型或預設設定。

Example

<configuration>
  <system.ServiceModel>
    <bindings>
      <ws2007HttpBinding>
        <binding closeTimeout="00:00:10"
                 openTimeout="00:00:20"
                 receiveTimeout="00:00:30"
                 sendTimeout="00:00:40"
                 bypassProxyOnLocal="false"
                 transactionFlow="false"
                 hostNameComparisonMode="WeakWildcard"
                 maxReceivedMessageSize="1000"
                 messageEncoding="Mtom"
                 proxyAddress="http://www.contoso.com"
                 textEncoding="utf-16"
                 useDefaultWebProxy="false">
          <reliableSession ordered="false"
                           inactivityTimeout="00:02:00"
                           enabled="true" />
          <security mode="Transport">
            <transport clientCredentialType="Digest"
                       proxyCredentialType="None"
                       realm="someRealm" />
            <message clientCredentialType="Windows"
                     negotiateServiceCredential="false"
                     algorithmSuite="Aes128"
                     defaultProtectionLevel="None" />
          </security>
        </binding>
      </ws2007HttpBinding>
    </bindings>
  </system.ServiceModel>
</configuration>

另請參閱