What is the difference between an asp.net web method and a wcf service?

前端 未结 9 975
太阳男子
太阳男子 2020-11-30 19:29

I\'m new to .Net and do not understand the difference. Can someone point me in the right direction?

相关标签:
9条回答
  • 2020-11-30 19:47

    ASP.NET Web services was developed for building applications that send and receive messages by using the Simple Object Access Protocol (SOAP) over HTTP.

    WCF is for enabling .NET Framework applications to exchange messages with other software entities. SOAP is used by default, but the messages can be in any format, and conveyed by using any transport protocol.

    You can view ASP.NET web services as a subset of WCF services.

    Here is a link comparing the two frameworks.

    0 讨论(0)
  • 2020-11-30 19:49

    I had the same problem.

    I found the book Microsoft Windows Communication Foundation Step by Step to be really good.

    If you just want to do the traditional webservice thing using WCF, then Chapter 1 of that book will show you exactly how to do that (write service, test, deploy, use service).

    Its written for VS2005, but I'm using vs2008 and found it even easier.

    There's a lot more to WCF, but that book is a good start.

    0 讨论(0)
  • 2020-11-30 19:52

    Web Services

    1. It Can be accessed only over HTTP
    2. It works in stateless environment

    WCF

    WCF is flexible because its services can be hosted in different types of applications. The following lists several common scenarios for hosting WCF services:

    • IIS
    • WAS
    • Self-hosting
    • Managed Windows Service
    0 讨论(0)
  • 2020-11-30 19:55

    In addition to the above responses, WCF was created to replace .NET Remoting in .NET 3.0 and beyond. In addition to SOAP, REST, POX, etc. web services in various formats (e.g. XML and JSON), WCF also offers MSMQ and Named Pipes. ASMX, as mentioned above, provides only SOAP-based XML web services.

    You would need to delve into .NET Remoting for other types of communication protocols. For additional information, you should check out Pro C# 2008 and the .NET 3.5 Framework. It's a great resource, and you can get the chapters from the previous books that cover .NET Remoting, and other replaced features.

    0 讨论(0)
  • 2020-11-30 19:57

    They are two different things all together. WCF is a more generic framework through which you can write one service type component and deploy it in many ways (even as an Asp.Net Web Service).

    Here's a brief thread about this http://social.msdn.microsoft.com/Forums/en-US/wcf/thread/2d6a7ff2-f15c-4599-a389-a81cfffcc852/

    0 讨论(0)
  • 2020-11-30 19:59

    They are two different frameworks for writing services. WCF is generally more flexible and provides configurable options for what protocols are used, how the service is hosted and a variety of security options. ASMX offers SOAP based services. Generally WCF is also more performant. In general ASMX is easier to use and generally has less of a learning curve.

    Here is a MSDN forum discussion on the topic. Here are the getting started pages for ASMX and WCF.

    0 讨论(0)
提交回复
热议问题