简体   繁体   English

通过.NET 4.0中的服务引用来使用WCF服务

[英]Consuming WCF service via service reference in .NET 4.0

I've been reading a little bit on WCF, and the general consensus on the web is that consuming a WCF service via Visual Studio's add service reference isn't the preferred/right way as it adds a lot of bloatware code. 我一直在阅读关于WCF的一点点,网上的普遍共识是,通过Visual Studio的添加服务引用来消费WCF服务并不是首选/正确的方式,因为它增加了大量的膨胀软件代码。

However, most of these posts are from 2009, with .NET 3.5. 但是,这些帖子大部分来自2009年的.NET 3.5。

I'd like to know if this situation has improved with .NET 4.0, or .NET 4.5, and is it still recommended to consume a service manually over the VS way? 我想知道.NET 4.0或.NET 4.5是否已经改善了这种情况,是否仍然建议通过VS方式手动使用服务?

Is the performance difference between the manual and service reference way very glaring? 手动和服务参考方式之间的性能差异是非常明显的吗?

I don't think that it's ever been performance difference between manual and service referenced proxy classes. 我不认为手动和服务引用代理类之间的性能差异。 It generates unused code, yes. 它会生成未使用的代码,是的。 But if you want, you can manually clean up it. 但如果您愿意,可以手动清理它。

Hand written proxy will save you milliseconds during compilation. 手写代理将在编译期间节省毫秒数。 But you will spend way more time on writing proxy class manually and testing it. 但是,您将花费更多时间手动编写代理类并对其进行测试。

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

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