.net WCF - 优点和缺点
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/502780/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
WCF - advantages and disadvantages
提问by agnieszka
I would like to find out about BOTH advantages and disadvantages of Windows Communication Foundation from people who have used it or just know it theoretically.
我想从使用过它或仅从理论上了解它的人那里了解 Windows Communication Foundation 的优点和缺点。
回答by Tad Donaghe
Primary advantage: Once you get over the learning curve, WCF makes it relatively easy to expose and consume software components. i.e. Given a component bakes functionality into a WCF Service Contract, a developer can expose that same component in-proc, across processes on a single box, across a Windows intranet, or throughout the internet all by just changing hosts and configuration information. Likewise it's easy for clients of said component to use it in any of those scenarios as well.
主要优势:一旦您克服了学习曲线,WCF 就可以相对容易地公开和使用软件组件。即,给定一个组件将功能烘焙到 WCF 服务契约中,开发人员可以通过更改主机和配置信息,在进程内、单个机器上的进程、Windows Intranet 或整个 Internet 中公开相同的组件。同样,所述组件的客户也很容易在任何这些场景中使用它。
Primary disadvantage: the learning curve. WCF seems very daunting to many developers when they first begin looking into it. I made several false starts trying to get into Juval Lowy's "Programming WCF Services." Though I've found that comprehension came quickly once I began actually creating and consuming components.
主要缺点:学习曲线。当许多开发人员第一次开始研究 WCF 时,他们似乎非常令人生畏。我尝试进入 Juval Lowy 的“Programming WCF Services”做了几个错误的开始。虽然我发现一旦我开始实际创建和使用组件,理解就会很快。
The key thing to rememberis that WCF let's you write some nice functional code and wrap it into a component that you can then relatively easily use just about anywhere with just about any amount of security, reliability and durability.
要记住的关键是,WCF 让您可以编写一些漂亮的功能代码并将其包装到一个组件中,然后您可以相对轻松地在几乎任何地方使用,并且具有几乎任何数量的安全性、可靠性和持久性。
Compared to what we were forced to use previously, WCF is fantasitc!
与我们之前被迫使用的相比,WCF 真是太棒了!
回答by Lonzo
A major advantage is that WCF allows a single consistent access to windows communication technologies for developers thereby enabling easier development of SOA applications. Microsoft has abstracted a lot of the plumbing work so as to enable this.
一个主要优点是 WCF 允许开发人员对 Windows 通信技术进行单一一致的访问,从而使 SOA 应用程序的开发更加容易。微软已经抽象了很多管道工作来实现这一点。
A drawback would be that, WCF is Microsoft's implementation of SOA and hence its APIs are solely controlled by MS which makes interoperability a bit difficult. Also, to deploy WCF apps, you will need more underlying hardware resources on the platform on which the WCF applications will be running, since there is an additional layer of abstraction to deal with.
一个缺点是,WCF 是微软的 SOA 实现,因此它的 API 完全由 MS 控制,这使得互操作性有点困难。此外,要部署 WCF 应用程序,您将需要运行 WCF 应用程序的平台上的更多底层硬件资源,因为还有一个额外的抽象层需要处理。
回答by Robert MacLean
For me it is that your code to communicate via SOAP, WS*, TCP, MSMQ, Named Pipes or any other transport later is the same.
对我来说,您以后通过 SOAP、WS*、TCP、MSMQ、命名管道或任何其他传输进行通信的代码是相同的。
回答by Elijah Glover
advantages
好处
- Its made of a lot of different components, so you can create new components for security, transport, authentication
- Its faster than ASMX
- Supports Scaling/Load Balancing
- Its Interoperability, for java, and more..
- 它由许多不同的组件组成,因此您可以为安全、传输、身份验证创建新组件
- 它比 ASMX 快
- 支持扩展/负载平衡
- 它的互操作性,适用于 Java 等。
disadvantages- bit of a learning curve to learn about all the different transport types/security spec.
缺点- 要了解所有不同的传输类型/安全规范,需要一点学习曲线。
If you want anything faster you would have to go to the TCP level
如果您想要更快的速度,则必须进入 TCP 级别
EditAlso Its Hard To Get To Grips With Concurrency To Do With Connected Clients
编辑也很难掌握与连接客户端有关的并发性
回答by Danny Varod
The advantage is a standard architecture for SOA applications. You cancustomize the components of the architecture to enable connection with any kind of non-Windows clients, however there is a steep learning curve.
优点是 SOA 应用程序的标准架构。您可以自定义体系结构的组件以启用与任何类型的非 Windows 客户端的连接,但是学习曲线很陡峭。
回答by Quibblesome
I don't think there are supposed to be inherent trade-offs aside from having to use the WinStack. WCF is supposed to be replacing both .NET remoting and bog standard web services (or rather WCF can also do Web Services)
我认为除了必须使用 WinStack 之外,不应该有内在的权衡。WCF 应该同时取代 .NET 远程处理和 bog 标准 Web 服务(或者更确切地说 WCF 也可以执行 Web 服务)
回答by Mendelt
I found it very easy to set up and learn. I had a web-service running in a few hours without any experience using WCF. I can do it in a few minutes now.
我发现它很容易设置和学习。我在几个小时内运行了一个 Web 服务,但没有任何使用 WCF 的经验。我现在可以在几分钟内完成。
The downside of this is that I still know next to nothing about webservices. This can turn around and bite you later. Its very easy to make the wrong design decisions based on incorrect assumptions on how things work. It's very easy to maintain state in your service classes for example but this will cause scaling-problems later.
这样做的缺点是我对网络服务几乎一无所知。这可能会在以后转过身来咬你。基于对事物如何运作的错误假设,很容易做出错误的设计决策。例如,在您的服务类中维护状态非常容易,但这会导致稍后的扩展问题。

