使用Fiddler解析WCF RIA Service传输的数据
????? 使用Fiddler 2 解析WCF RIA Service傳輸的數據,您需要安裝一個PlugIn。下載解壓后,放在Inspectors文件中。重新啟動Fiddler,你就會看到WCF Binary的選項。
????? 下面的場景是,點一個Button根據ID查詢數據,UI如下圖:
?????
???? Server端Code,ItemContext是DomainContext基類
1: var tt = new ItemContext(); 2: tblItemDataGrid.ItemsSource = tt.tblItems; 3: EntityQuery<tblItem> s = tt.GetTblItemsByItemNumberQuery(txtItemNumber.Text == "" ? 0 : Convert.ToInt32(txtItemNumber.Text)); 4: LoadOperation<tblItem> op = tt.Load(s);?????? 此時我們通過Monitor可以看到類似下面文本:
@GetTblItemsByItemNumberResponsehttp://tempuri.org/@GetTblItemsByItemNumberResult aDomainServices i)http://www.w3.org/2001/XMLSchema-instance^TotalCount�^RootResults b7http://schemas.datacontract.org/2004/07/RIAServices.Web_tblItem_ItemDescription�Item Name1_ItemNumber�_Quantity�???????? 就會被還原到這樣的明文:
<GetTblItemsByItemNumberResponse xmlns="http://tempuri.org/"> <GetTblItemsByItemNumberResult xmlns:a="DomainServices" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"> <a:TotalCount>1</a:TotalCount> <a:RootResults xmlns:b="http://schemas.datacontract.org/2004/07/RIAServices.Web"> <b:tblItem> <b:ItemDescription>Item Name1</b:ItemDescription> <b:ItemNumber>1</b:ItemNumber> <b:Quantity>1</b:Quantity> </b:tblItem> </a:RootResults> </GetTblItemsByItemNumberResult></GetTblItemsByItemNumberResponse>? 是不是很實用,如果您是Debug本地的localhost的站點,可能需要修改hosts文件,或修改它的js配置。可以參考官方網站。
? 本文所使用例子是 可參考 WCF RIA Services 快速上手
? 希望對您開發有幫助。
作者:Petter Liu
出處:http://www.cnblogs.com/wintersun/
本文版權歸作者和博客園共有,歡迎轉載,但未經作者同意必須保留此段聲明,且在文章頁面明顯位置給出原文連接,否則保留追究法律責任的權利。
該文章也同時發布在我的獨立博客中-Petter Liu Blog。
轉載于:https://www.cnblogs.com/wintersun/archive/2011/01/05/1926386.html
總結
以上是生活随笔為你收集整理的使用Fiddler解析WCF RIA Service传输的数据的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 关于团队的一些技巧
- 下一篇: Windows编程-- 用户方式中线程的