Web Services — WCF vs. ASMX (“Standard”)

前端 未结 7 1856
鱼传尺愫
鱼传尺愫 2020-11-28 05:56

I am working on a new project. Is there any benefit with going with a WCF web service over a regular old fashion web service?

Visual Studio offers templates for both

相关标签:
7条回答
  • 2020-11-28 05:57

    The Pros of doing all by yourself is:

    • No learning curve
    • Very flexible

    The Pros of WCF are:

    • Costs less time in the longer run
    • Switch protocols without programming

    A disadvantage of WCF: some static property names can be pretty lengthy...

    To summarize: WCF lets you focus on programming, but you need to learn it first ;-)

    0 讨论(0)
  • 2020-11-28 06:02

    What is a "regular old fashioned web service?" An ASMX service, or are you using WSE as well? ASMX services are not naturally interoperable, don't support WS-* specs, and ASMX is a technology that is aging very quickly. WSE (Web Service Enhancements) services DO add support for WS-* and can be made to be interoperable, but WCF is meant to replace WSE, so you should take the time to learn it. I would say that unless your application is a quick an dirty one-off, you will gain immense flexibility and end up with a better design if you choose WCF. WCF does have a learning curve beyond a [WebMethod] attribute, but the learning curve is over-exaggerated in my opinion, and it is exponentially more powerful and future proof than legacy ASMX services.

    Unless your time line simply cannot tolerate the learning curve, you would be doing yourself a huge favor learning WCF instead of just sticking with ASP.NET Web Services. Applications will only continue to become more and more distributed and interconnected, and WCF is the future of distributed computing on the Microsoft platform.

    Here is a comparison between the two.

    0 讨论(0)
  • 2020-11-28 06:02

    Pro for WCF : You don't need a web server (i.e. IIS). You actually don't need a server OS.

    0 讨论(0)
  • 2020-11-28 06:04

    Unit tests on your services implamentation and interaction are easier to do !

    0 讨论(0)
  • 2020-11-28 06:10

    In my experience

    WCF

    It is absurdly verbose to work with it, it is not quite compatible with other microsoft products and, of course, it is not widely accepted outside ot the microsoft world.

    But my main problem is it is not stable, it trends to fail (in some situation) and it requires to tweak it before it can be used.

    Instead

    SOAP (aka standard Webservice), it works, it is easy to work and it is widely compatible (Java-JAX accepts it without any modification).

    To add authentication in SOAP could be a bit tricky but not impossible.

    0 讨论(0)
  • 2020-11-28 06:18

    If your project is using framework 4.0, Why don't your try WebApi, which is easy to understand and uses the convention over configuration.

    Its a great way of building application with super fast interfaces

    Have look at the getting started videos from MS, It has evolved from WCF data Services.

    http://www.asp.net/web-api/overview/getting-started-with-aspnet-web-api

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