共用方式為


Windows Web 服務範例

下列範例示範如何使用 Windows Web 服務 API。

服務模型範例

計算機服務:用戶端:HttpCalculatorClientExample、伺服器:HttpCalculatorServiceExample

具有 SSL 傳輸安全性的計算機服務:用戶端:HttpCalculatorWithSslClientExample、伺服器:HttpCalculatorWithSslServiceExample

透過 SSL 混合模式安全性使用使用者名稱的計算機服務:用戶端:HttpCalculatorWithUsernameOverSslClientExample、伺服器:HttpCalculatorWithUserNameOverSslServiceExample

透過 SSL 混合模式安全性使用 Kerberos 的計算機服務:用戶端:HttpCalculatorWithKerberosOverSslClientExample、伺服器:HttpCalculatorWithKerberosOverSslServiceExample

採購單服務:用戶端:HttpPurchaseOrderClientExample,伺服器:HttpPurchaseOrderServiceExample

具有 SSL 傳輸安全性的採購單服務:用戶端:HttpPurchaseOrderWithSslClientExample、伺服器:HttpPurchaseOrderWithSslServiceExample

透過 SSL 混合模式安全性使用使用者名稱的採購單服務:用戶端:HttpPurchaseOrderWithUsernameOverSslClientExample,伺服器:HttpPurchaseOrderWithUserNameOverSslServiceExample

透過 SSL 混合模式安全性使用 Kerberos 的採購單服務:用戶端:HttpPurchaseOrderWithKerberosOverSslClientExample,伺服器:HttpPurchaseOrderWithKerberosOverSslServiceExample

UnTyped 採購單服務:伺服器:UnTypedServiceExample。 用戶端:UnTypedClientExample

工作階段計算機:伺服器:SessionfullCalculatorServiceExample。 用戶端:SessionfullCalculatorClientExample

使用自訂通道和接聽程式實作的計算機:伺服器:HttpCalculatorWithLayeredChannelServiceExample。 用戶端:HttpCalculatorWithLayeredChannelClientExample

使用編碼通道的計算機:伺服器:HttpCalculatorWithEncodedChannelServiceExample。 用戶端:HttpCalculatorWithEncodedChannelClientExample

處理原始 (非 SOAP) HTTP 要求的服務:用戶端:HttpRawClientExample。 伺服器:HttpRawServiceExample

服務工作中止通知:伺服器:BlockingServiceExample。 用戶端:ServiceCancellationExample

呼叫取消:伺服器:SessionfullCalculatorServiceExample。 用戶端:CallAbandonExample

手動建立原則描述,並用它來建立服務 Proxy:PolicyTemplateExample

TCP 通道層範例

使用單向模式傳送訊息的 TCP 範例:用戶端:OneWayTcpClientExample、伺服器:OneWayTcpServerExample

使用要求-回復模式傳送訊息的 TCP 範例:用戶端:RequestReplyTcpClientExample、伺服器:RequestReplyTcpServerExample

串流 TCP 範例:用戶端:StreamingTcpClientExample、伺服器:StreamingTcpServerExample

異步串流 TCP 範例:用戶端:AsyncStreamingTcpClientExample、伺服器:AsyncStreamingTcpServerExample

HTTP 通道層範例

HTTP 範例:用戶端:HttpClientExample、伺服器:HttpServerExample

使用串流 API 的 HTTP 範例:用戶端:StreamingHttpClientExample、Server:StreamingHttpServerExample

UDP 通道層範例

使用單向模式傳送訊息的 UDP 範例:用戶端:OneWayUdpClientExample、Server:OneWayUdpServerExample

使用多播要求回應模式傳送訊息的 UDP 範例:用戶端:MulticastUdpClientExample、伺服器:MulticastUdpServerExample 下列範例相同,但使用 IPv6 尋址方式:用戶端:MulticastUdpClientExample6、伺服器:MulticastUdpServerExample6

命名管道通道圖層範例

使用要求-回復模式傳送訊息的命名管道範例:用戶端:RequestReplyNamedPipesClientExample、Server:RequestReplyNamedPipesServerExample

名為 pipes 的串流範例:用戶端:StreamingNamedPipesClientExample、Server:StreamingNamedPipesServerExample

訊息範例

使用自定義訊息標頭的範例:CustomHeaderExample

編碼和譯碼訊息的範例:MessageEncodingExample

轉寄訊息的範例:ForwardMessageExample

XML 範例

使用 XML 緩衝區寫入和讀取 xml 的範例,ReadWriteXmlExample

使用 MTOM、WsWriteBytes、WsPushBytes 和 WsPullBytes ReadWriteBytesXmlExample 寫入和讀取二進位數據的範例

巡覽 XML 緩衝區的範例 NavigateXmlExample

依節點 ReadXmlExample 讀取 XML 檔節點的範例

尋找並顯示 XML 屬性的範例,ReadAttributeExample

ReadWriteArrayExample 寫入和讀取元素陣列的範例

將專案插入 XML 緩衝區的範例,InsertElementExample

顯示使用某些 XML 緩衝區協助程式函式的範例,XmlBufferExample

使用 wsutil 產生的協助程式函式來寫入和讀取衍生類型的範例,DerivedTypeExample

異步模型範例

說明異步函式模型的範例。 AsyncModelExample

安全性通道層範例

透過 TCP 的 Windows 傳輸安全性:用戶端:RequestReplyTcpClientWithWindowsTransportSecurityExample、伺服器:RequestReplyTcpServerWithWindowsTransportSecurityExample

透過命名管道的 Windows 傳輸安全性:用戶端:RequestReplyNamedPipesClientWithWindowsTransportSecurityExample、Server:RequestReplyNamedPipesServerWithWindowsTransportSecurityExample

SSL 傳輸安全性:用戶端:HttpClientWithSslExample、伺服器:HttpServerWithSslExample

透過 SSL 混合模式安全性的使用者名稱:用戶端:HttpClientWithUsernameOverSslExample、伺服器:HttpServerWithUsernameOverSslExample

透過 SSL 混合模式安全性的使用者名稱:用戶端:HttpClientWithKerberosOverSslExample、伺服器:HttpServerWithKerberosOverSslExample

元數據範例

下列範例示範如何使用擷取端點所支援通訊協議的相關信息來處理 WSDL 和原則檔。

透過 SSL 混合模式安全性的使用者名稱:MetadataImportWithUsernameOverSslExample。 透過 SSL 混合模式安全性發行的令牌:MetadataImportWithIssuedTokenOverSslExample。 X509 憑證透過 SSL 混合模式安全性:MetadataImportWithX509OverSslExample

WS-Metadata Exchange 範例

下列範例示範如何在 WS_SERVICE_HOST上啟用 WS-MetadataExchange。

已開啟 WS-MetadataExchange 的 TCP 服務:MetadataExchangeSample。 呼叫已啟用 WS-MetadataExchange 之 TCP 服務的 WCF 服務 Moniker 用戶端:ServiceMonikerSample

自定義標頭和服務模型

下列範例示範如何分別搭配 WS_SERVICE_PROXYWS_SERVICE_HOST 使用自定義標頭。

用戶端:HttpCustomHeaderPurchaseOrderClientExample,伺服器:HttpCustomHeaderPurchaseOrderServiceExample

檔案複寫範例

示範如何實作檔案復寫服務的完整範例:Tool:FileRepToolExample、Service:FileRepServiceExample

WCF 公用服務互作

Windows Web 服務用戶端會與 WCF 服務用戶端通訊:WcfPublicServiceSample

自訂 HTTP Proxy

Windows Web 服務用戶端會使用自定義 Proxy 用戶端與 ASMX TerraService 服務通訊:AsmxTerraServiceSampleWithCustomProxy