有什么选择呢?在.NET 3.5中ASMX Web服务或WCF? [英] What to choose? ASMX web service or WCF in .net 3.5?

查看:150
本文介绍了有什么选择呢?在.NET 3.5中ASMX Web服务或WCF?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目前的项目我的工作是使用Web服务的广泛,是在.NET 3.5。现在,当我们将实施第二阶段,我们都搞不清楚我们是否应该要么使用WCF或Web服务为已完成previously?再有什么新的,可以是有益的,是未来与.NET 4.0关于Web服务或WCF。

The current project i am working on is extensively using web services and is made in .net 3.5. Now as we are going for implementation of second phase we are confused if we should either use WCF or web service as done previously ? Further is there anything new that can be useful and is coming up with .net 4.0 regarding web services or WCF.

推荐答案

我们刚刚完成使用WCF,而不是ASMX Web服务,第一次一个全新的项目。我们非常满意的结果,但很清楚,有一个陡峭的学习曲线。即便如此,我们非常高兴与整体结果,并知道这是一切微软是做前进的基础,它一直是完全值得的痛苦 - 疣和所有

We just finished a brand new project using WCF instead of ASMX Web Services for the first time. We are VERY happy with the results, but do know that there was a steep learning curve. Even so, we are extremely pleased with the overall results and know that this is the basis for everything Microsoft is doing going forward and it has been totally worth the pain--warts and all.

快速收益我们获得了OVER ASMX

1)对于内部(防火墙后面)服务对服务调用我们使用net:TCP结合,这比SOAP快得多

1) For internal (behind firewall) service-to-service calls we use the net:tcp binding, which is much faster than SOAP

2)我们启用了一个网:TCP端点,只有一个配置文件更新网络在同一个服务端点(无code变化)

2) We enabled both a net:tcp endpoint and a "web" endpoint on the same service with only a configuration file update (no code changes)

3)我们能够创造AJAX的支持只需更改配置REST风格的Web服务和使用的已经建在DataContractJsonSerializer。要以其他方式做到这一点,我们将不得不写一个HTTP处理程序(ASHX),并处理大部分的JSON序列化和URL解析手。

3) We were able to create AJAX-supporting RESTful web services with only configuration changes and using the DataContractJsonSerializer that's already built in. To do this otherwise, we would have had to write an HTTP Handler (ashx) and handle most of the Json serialization and url parsing by hand.

4)我们的网站需要扩展的性能优化和稳定性,我们正在转换为使用MSMQ为基础的通讯结构是异步的,保证参与交易; WCF提供了一个MSMQ bindng只需要很少到没有我们的服务code变化 - 只是参考的更新和正确设置MSMQ与现有的服务(并添加属性事务边界)

4) As our site needs to scale for performance optimization and stability, we are looking at converting to using an MSMQ-based messaging structure that is asynchronous AND guaranteed and participates in transactions; WCF provides an MSMQ bindng that requires little-to-no code change in our services--just reference updates and setting up MSMQ properly with the existing services (and adding attributes for Transactional boundaries).

但要注意:真正投入学习这种(买蓝O型Reily书,通过它去)。有些事情就像在开发过程中的参数名-变化,实际上不破的服务引用,但导致被传递(内置版本偏移处理)空参数,托管模式,以考虑(Windows服务与IIS),和实例模型和FaultExceptions所有真正了解。我们没有去的,我们有一些疼痛。但是,我们犁前进,很高兴与我们的经验和教训,我们没有被捆绑到ASMX了灵活性和成长的机会!

BUT BE WARNED: Really invest in learning this (buy the blue O-Reily book and go through it). There are things like argument-name-changes during development that actually don't break the service references but result in null arguments being passed (built-in version skew handling), hosting models to consider (Windows Service vs. IIS), and instantiation models and FaultExceptions to all REALLY understand. We didn't going in and we had some pains. But we plowed ahead and are VERY happy with our learnings and the flexibility and growth opportunities we have not being tied to ASMX anymore!

这篇关于有什么选择呢?在.NET 3.5中ASMX Web服务或WCF?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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