欢迎访问 生活随笔!

生活随笔

当前位置: 首页 > 编程资源 > 编程问答 >内容正文

编程问答

使用Fiddler解析WCF RIA Service传输的数据

发布时间:2025/5/22 编程问答 35 豆豆
生活随笔 收集整理的这篇文章主要介绍了 使用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传输的数据的全部内容,希望文章能够帮你解决所遇到的问题。

如果觉得生活随笔网站内容还不错,欢迎将生活随笔推荐给好友。