简体   繁体   English

ASP.NET 3.5 Web服务

[英]ASP.NET 3.5 Webservices

I am about to start my first web service in ASP.NET. 我即将在ASP.NET中启动我的第一个Web服务。 when searching in google it shows 在谷歌搜索时显示

RestFul Service

SOAP services

WCF 

Which one is stable?.What is the key differece among them? 哪一个稳定?它们之间的主要区别是什么?

Define "stable" ;-p 定义“稳定” ;-p

If you mean "time in the field", then for .NET the order would be SOAP (asmx), WCF, REST 如果您的意思是“现场时间”,那么对于.NET,顺序为SOAP(asmx),WCF,REST

Note that there is a big shift between the data-centric REST services (typical of ADO.NET Data Services) and WCF / asmx, which are operation-centric. 请注意,以数据为中心的REST服务(通常是ADO.NET数据服务)和以操作为中心的WCF / asmx之间有很大的转变。

REST is perhaps more flexible for the caller; REST对于调用者而言可能更灵活。 WCF / asmx has more rigid control (in terms of exposing discreet operations). WCF / asmx具有更严格的控制(就公开谨慎操作而言)。 Both have their places, but I tend to still make my default the operation-centric approach (via WCF) in most cases (a defined number of things to test, etc). 两者都有自己的位置,但是在大多数情况下(通过一定数量的要测试的东西,等等),我还是倾向于默认使用以操作为中心的方法(通过WCF)。

WCF is a bit more evolved than the original web-services offered in .NET, and has better WSE support (although asmx can be extended via WSE3). 与.NET中提供的原始Web服务相比,WCF有所发展,并且具有更好的WSE支持(尽管可以通过WSE3扩展asmx)。 If you are starting today, WCF would be a better choice than asmx in most cases. 如果您今天就开始,在大多数情况下,WCF比asmx是更好的选择。

Definitely go with WCF - it's the current and future technology for cross-machine communication. 绝对可以与WCF一起使用-这是跨机器通信的当前和未来技术。

The question of SOAP vs. REST is a bit like manual vs. automatic transmission - it depends on your needs and preferences. SOAP与REST的问题有点像手动与自动传输-它取决于您的需求和偏好。

SOAP is in general a bit more sturdy - it has things like WSDL and XSD - schema and metadata to clearly and definitely describe a service and all its methods and all its data being passed around. SOAP通常更坚固-它具有诸如WSDL和XSD之类的东西-模式和元数据,可以清楚明确地描述服务及其所有方法和所有传递的数据。 Highly useful in enterprise environments. 在企业环境中非常有用。

REST on the other hand is the much more approachable, easy to understand, just-point-your-code-at-a-URL-and-get-XML-back approach. 另一方面, REST是一种更易于访问,更易于理解的方法,只需将您的代码指向URL并获取XML返回即可。 Works well, it's almost human-readable, less overhead, but also less "security" - since there's really hardly any metadata describing the service - either you know it yourself since you're the author of the service, or the service provider has a good documentation somewhere. 效果很好,几乎是人类可读的,开销更少,但“安全性”也更低-因为实际上几乎没有任何元数据描述该服务-因为您是服务的作者,所以您自己就知道它;或者服务提供商拥有一个好的文档。

So there's no clear winner in my opinion - pick the one closer to your needs and your preferences. 因此,我认为没有明显的赢家-选择一个更接近您的需求和偏好的赢家。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM