ASMX 与 WCF
我需要一些与这个主题相关的指导; 也许我错过了显而易见的事情。
我没有看到绑定到 HTTP 的 WCF 和强类型 Web 服务之间的对比。 为什么这会有所不同? 我同意 ASMX 与 WCF 中存在一些与 XmlSerializer 特别相关的开发细微差别以及大量的 Microsoft 术语。 缺少这些; 我只看到并行
DataContract=WSDL 类型 ServiceContract=WSDL(又名服务定义) OperationContract=WebMethod
在操作上,我知道使用 WCF 可以进行大量绑定,而不是锁定到 HTTP,这可能涉及繁重的构建和拆卸。 但对于松散耦合来说,这一切都将是 Web 服务。
还有其他操作上的区别吗?
有人可以向我展示光明并让我摆脱痛苦吗? :))
I need some direction related to this topic; maybe I am missing the obvious.
I dont see a contrast between WCF bound to HTTP and strongly typed web service. Why would this be any different?? I agree there are some development nuances especially related to XmlSerializer in ASMX vs WCF and a plethora of Microsoft jargons. Short of these; i only see parallels
DataContract=WSDL Type
ServiceContract=WSDL (aka service definition)
OperationContract=WebMethod
Operationally, I understand the binding can be numerous with WCF instead of getting locked down to HTTP, which can involve heavy construct and tear down. But for loose coupling it will all be web services.
Are there other operational differences??
Can someone show me the light and put me out of my misery?? :))
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
好吧,如果您将讨论减少到仅 HTTP,那么 WCF 相对于 ASMX 仍然具有许多优势:
简而言之:即使当您将 WCF 限制为仅 HTTP 时差异可能会更小,但我仍然认为它是优越的,如果您今天可以选择开始新的东西,无论如何,使用WCF代替ASMX!
Rick Strahl 在他的博客文章中说得非常好:
我认为,即使您坚持使用纯 HTTP 和 SOAP,对任何新服务使用 WCF 也可能是一个好主意,因为通过使用 WCF 创建服务,您可以稍后决定使用 WAS 发布相同的服务,并提供更高的性能TCP/IP 传输。 或者,您可能会被要求提供 WS 协议的一些高级功能,例如事务、附件、会话管理、加密等。通过使用 WCF,您正在构建着眼于未来的服务,以便您可以轻松迁移直到其他协议——其中一些协议今天可能还不存在。 当然,未来将会出现新技术,WCF 通过其抽象层和通用 API 在一定程度上保护您。*
Marc
Well, if you reduce your discussion to only HTTP, then there's still a slew of advantages that WCF has over ASMX:
In short: even though the differences might be smaller when you restrain WCF to just HTTP, I still think it's superior and if you have the choice to start something new today, by all means, use WCF instead of ASMX!
Rick Strahl puts it very nicely in his blog post:
I would argue that using WCF for any new services is probably a good idea even if you stick with pure HTTP and SOAP because by creating your service with WCF you can decide later on to publish this same service using WAS and also provide the more high performance TCP/IP transport. Or you might be asked to provide some of the advanced features of WS- protocols like transactions, attachments, session management, encryption etc. By using WCF you are building your service with a view to the future so you can easily move up to other protocols-some of which may not even exist today. Certainly new technologies will come along in the future and WCF protects you somewhat through its abstraction layer and common API.*
Marc
对于 ASMX Web 服务的使用者来说,还有一点是,任何使用该 Web 服务的平台都必须实现 SOAP 堆栈。 如果您的目标是广泛使用,那么 WCF 更可取,它允许您以更通用的方式公开 WS。
Another point for the consumers of the ASMX web service, which ever platforms will consume the web service will have to implement a SOAP stack. If you're goal is for wide reaching consumption, WCF is preferable and will allow you to expose the WS in more universal ways.
这两种技术之间的另一个重大区别是,Microsoft 现在将 ASMX Web 服务和 XML Serializer 视为“遗留技术”,并且不再修复其中的错误。
The other big distinction between the two technologies is that Microsoft now considers both ASMX web services and XML Serializer to be "legacy technology", and is no longer fixing bugs in them.