自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

對WCF客戶端解釋說明

開發(fā) 后端
使用WCF客戶端,開發(fā)人員可以隨意的構(gòu)建跨平臺、安全、可靠和支持事務(wù)處理的企業(yè)級互聯(lián)應(yīng)用解決方案。大大的提高了工作效率。

WCF客戶端包括許多新的和改進的用于提高工作效率的功能。IDE 還進行了重新設(shè)計,從而向開發(fā)人員提供對.NET Framework 組件的直接訪問。

[注:Method、Operation 中文都叫做「方法」,但前者是存在 OO 中的類,不存在網(wǎng)絡(luò)上;后者存在于 Service 中,公開在網(wǎng)絡(luò)上可供其他程序調(diào)用。WCF、Data Services 和 RIA Services 中公開在網(wǎng)絡(luò)上的函數(shù)和方法,都可稱作 Operation。#t#

關(guān)于這點,小弟我查了微軟 MCTS 認(rèn)證 WCF 3.5 的官方用書 [10]、O'Reilly 的書籍 [11],都未提到如何解決,書中只提到 .NET collections 的 metadata,以 WSDL 在網(wǎng)絡(luò)上傳輸時,會以「數(shù)組 (array)」的格式呈現(xiàn)。

Because .NET collections are .NET-specific, WCF cannot expose them in the service metadata, yet because they are so useful, WCF offers dedicated marshaling rules for collections.

Whenever you define a service operation that uses the collection interfaces IEnumerable<T>, IList<T>, or ICollection<T>, the specific collection-type information gets lost in the metadata (WSDL) export, so in terms of how collection types are sent across the wire, they all are represented as arrays, the resulting metadata always uses an array.

開發(fā)WCF客戶端 時,若 VS 2008 都用默認(rèn)配置,則當(dāng) WCF 的服務(wù)器端函數(shù) (Operation) 的返回類型為 List<string> 時,實際返回的類型為 string[] 數(shù)組,因此客戶端若仍用 List<string> 的變量去接收和賦值時,在編譯時期,即會發(fā)生下圖 1 的轉(zhuǎn)型錯誤:

WCF 客戶端程序「添加服務(wù)引用 (Add Service Reference)」的設(shè)置即可處理此種需求。做法如下:

請參閱本帖。當(dāng)我們的WCF客戶端程序,要引用網(wǎng)絡(luò)上既有的 WCF 服務(wù)契約時,我們會如下圖 2 般,添加一個 service proxy reference。

 


責(zé)任編輯:chenqingxiang 來源: 計世網(wǎng)
相關(guān)推薦

2009-11-05 13:00:25

WCF客戶端

2009-12-22 18:18:11

WCF客戶端編程

2009-12-08 16:47:06

WCF IP

2010-02-25 16:20:02

WCF客戶端

2009-12-22 10:29:59

WCF客戶端處理

2009-12-08 16:15:13

WCF服務(wù)

2009-12-07 17:46:52

WCF框架

2010-02-23 09:58:21

WCF客戶端驗證

2010-02-24 16:39:27

WCF客戶端處理

2009-11-05 13:08:44

WCF客戶端配置

2009-12-21 15:53:56

WCF獲取客戶端IP

2010-02-22 11:10:17

WCF獲取客戶端IP

2009-11-09 15:49:01

WCF異步調(diào)用

2011-09-09 09:44:23

WCF

2009-12-07 17:28:55

WCF數(shù)據(jù)

2009-12-21 10:19:05

Silverlight

2010-02-24 16:17:09

WCF獲取客戶端IP

2009-12-08 09:33:53

WCF服務(wù)

2010-02-23 15:12:25

WCF客戶端

2010-04-15 11:05:51

Oracle客戶端配置
點贊
收藏

51CTO技術(shù)棧公眾號