如何在Windows Mobile CE 6.0设备中反序列化json数据 [英] How to deserialize json data in windows mobile CE 6.0 device
问题描述
我在VS 2008中创建了一个智能设备项目c#。
这个项目调用wcf服务,返回json数据。
我正在对json数据进行desrializing并添加引用作为System.Web.Extensions.dll 3.5
这是我的代码...
= ==========
HttpWebResponse webresponse =(HttpWebResponse)webrequest.GetResponse();
StreamReader loResponseStream = new StreamReader(webresponse.GetResponseStream(), enc);
string strResult = loResponseStream.ReadToEnd();
RootObject ss = new JavaScriptSerializer()。反序列化< rootobject>(strResult);
foreach(ss.IsValidStatus中的var项目)
{
sRetMessage = item.RtnMessage;
}
===========
但是这个代码工作正常,如果我从\bin\debug \ SmartAppl.exe执行exe文件
但是,如果我在设备中部署和运行,它会抛出错误,因为无法从.net f加载程序集 ramework。
我已将System.Web.Extensions.dll设置为LocalCopy = True。
为什么会发生这种情况?
是否有任何dll要为智能设备反序列化json数据?
请帮助我。
谢谢
I have created a smart device project in VS 2008 c#.
This project invoke wcf services, which return json data.
I am desrializing json data and added reference as System.Web.Extensions.dll 3.5
Here is a my code...
===========
HttpWebResponse webresponse = (HttpWebResponse)webrequest.GetResponse();
StreamReader loResponseStream = new StreamReader(webresponse.GetResponseStream(), enc);
string strResult = loResponseStream.ReadToEnd();
RootObject ss = new JavaScriptSerializer().Deserialize<rootobject>(strResult);
foreach (var item in ss.IsValidStatus)
{
sRetMessage = item.RtnMessage;
}
===========
However this code working properly, if i execute exe file from \bin\debug\SmartAppl.exe
But, if i deploy and run in device, it throws error as "could not load the assembly from .net framework".
I have set System.Web.Extensions.dll to LocalCopy=True also.
Why this is happening?
Is there any dll to deserialize json data for smart device ?
Please help me.
Thanks
推荐答案
你需要在设备上安装.net框架只有WM 6.1或6.5内置了
框架位置它在C:\Program Files(x86)\ Microsoftoft.NET \ SDK \ CompactFramework \v3.5 \ WindowsCE依赖于.CAB必须安装的设备
并从这里反序列化JSON下载库http://json.codeplex.com/releases/view/50552
解压缩并使用Json35r8上的Newtonsoft.Json.Compact.dll / Bin / Compact文件夹
i希望这是有帮助的
You need to install .net framework on device only WM 6.1 or 6.5 has built in
the framework location its at C:\Program Files (x86)\Microsoft.NET\SDK\CompactFramework\v3.5\WindowsCE depends on device which .CAB have to install
and to deserialize JSON download library from here http://json.codeplex.com/releases/view/50552
Unzipped and use the Newtonsoft.Json.Compact.dll on the Json35r8/Bin/Compact Folder
i hope this be helpfull
这篇关于如何在Windows Mobile CE 6.0设备中反序列化json数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!