WCF 服务与 Web 服务和 REST 服务的区别 [英] difference between WCF Services and Web Services and REST Service

查看:59
本文介绍了WCF 服务与 Web 服务和 REST 服务的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

.net 中的 WCF 服务和 Web 服务有什么区别
我应该何时使用 WCF,何时使用 Web 服务.REST 和 WCF 服务是否相同?谢谢

What is the difference between WCF Services and Web Services in .net
When should I use WCF and when to use Web Services.Is REST and WCF service the same? Thanks

推荐答案

Web 服务 是一个抽象术语,包含用于分布式系统的大量数据提供者.也许您指的是 ASMX 网络服务,它仍然可以在野外找到,但现在在新的开发中并没有真正广泛使用.

Web Service is an abstract term encompassing a large variety of data providers for distributed systems. Perhaps you are referring to ASMX web services, which can still be found in the wild but aren't really widely used in new development these days.

WCF Service 是 Microsoft 的 SOAP 实现.还有其他实现方式,或者您可以推出自己的实现方式(不推荐).

WCF Service is Microsoft's implementation of SOAP. There are others implementations or you could roll your own (not recommended).

SOAP 是一种有状态、基于会话、基于消息的 Web 服务.如果您的服务设计为一组复杂的操作,那就太好了.

SOAP is a kind of stateful, session-based, message-based web service. It's good if your service is designed as a set of complex actions.

REST 是一种无状态、无会话、基于资源的 Web 服务.如果您的服务旨在访问数据并对其执行简单的 CRUD 操作,那就太好了.SOAP 和 REST 是互斥的.一项服务不能两者兼而有之.有一些方法可以操作 vanilla WCF 以使其成为 RESTful,但这些技术已被弃用.如果要实现 RESTful Web 服务,Microsoft 世界中有两个主要选择:WCF 数据服务和 ASP.NET Web API.

REST is a stateless, sessionless, resource-based web service. It's good if your service is designed to access data and perform simple CRUD operations on it. SOAP and REST are mutually exclusive. A service cannot be both. There are ways to manipulate vanilla WCF to make is RESTful but these techniques are becoming deprecated. If you want to implement a RESTful web service there are two main choices in the Microsoft world: WCF Data Services and ASP.NET Web API.

这篇关于WCF 服务与 Web 服务和 REST 服务的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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