wcf webservice应以JSON格式响应,而不是xml格式的数据库(sqlserver)连接 [英] wcf webservice that should response in JSON format not in xml format with database (sqlserver) connectivity

查看:121
本文介绍了wcf webservice应以JSON格式响应,而不是xml格式的数据库(sqlserver)连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建wcf webservice,应该以JSON格式响应而不是xml格式和数据库(sqlserver)连接



我听说休息wcf服务。我认为wcf webservice也称为rest wcf服务。请解释一下。



请帮我详细说明。



非常感谢,。< b / b
有人发布了链接。但这不属于从数据库访问的数据。所以,请帮助我。



i我将使用软件工具:vs 2010,sqlserver,.net 4.0

I want to create wcf webservice that should response in JSON format not xml format and database (sqlserver) connectivity

and i heard rest wcf service. i think wcf webservice is also called as rest wcf service. please explain that also.

kindly help me with full explanation.

Thanks a lot,.

somebody posted link .but that not belong to data accessing from database. so, pls help me out.

i am gonna to use software tool: vs 2010,sqlserver , .net 4.0

推荐答案

WCF Webservice和REST Web服务也是一样。 WCF WS可能是也可能不是REST,REST可能会也可能不会使用WCF实现。 REST使用http动词(GET,DELETE,PUT,POST等)。要将JSON指定为数据交换的格式,需要在WebInvoke属性中添加RequestFormat = WebMessageFormat.Json,ResponseFormat = WebMessageFormat.Json。



请参阅文章 - 带有JSON的WCF REST服务以获取更多详细信息。
WCF Webservice and REST Web services aint same. WCF WS may or may not be REST and REST may or may not be implemented using WCF. REST uses the http verbs (GET, DELETE, PUT, POST etc). To specify JSON as the format of data interchange, you need to add "RequestFormat=WebMessageFormat.Json, ResponseFormat=WebMessageFormat.Json" in the WebInvoke attribute.

Please refer to the article - WCF REST Service with JSON for more details.


这篇关于wcf webservice应以JSON格式响应,而不是xml格式的数据库(sqlserver)连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆