参看:
1, http://keithelder.net/2008/10/17/WCF-vs-ASMX-WebServices/
2, http://www.cnblogs.com/philzhou/archive/2010/08/11/wcf_vs_web_service.html
3, http://www.bishoylabib.com/2009/08/comparing-asmx-and-wcf.html
要点:
旧的Web Service 仅能在 HTTP 环境下使用,非有比较多的限制条件;
新的 WCF 几乎不限定使用条件,可在HTTP 及 TCP/IP 等
The development of web service with ASP.NET relies on defining data and relies on the XmlSerializer to transform data to or from a service.
Key issues with XmlSerializer to serialize .NET types to XML
- Only Public fields or Properties of .NET types can be translated into XML.
- Only the classes which implement IEnumerable interface.
- Classes that implement the IDictionary interface, such as Hash table can not be serialized.
The WCF uses the DataContractAttribute and DataMemeberAttribute to translate .NET FW types in to XML.
[DataContract]
public class Item
{
[DataMember]
public string ItemID;
[DataMember]
public decimal ItemQuantity;
[DataMember]
public decimal ItemPrice;}