2

Some time ago, about 2 years ago, I was working on web portal that was developed in .NET 2.0. and had plenty of asmx pages.

The other day, one of my coleagues that was more adept at ASP .NET said: "ASMX is old and ugly, we shoud rewrite it". So we did it, as far as I remember we moved to ashx handler.

But now, as I'm preparing to pass 70-515, I came across one some materials that still suggest to learn asmx services (with respect to AJAX). So is that approach still valid in new ASP .NET 3.5/4.0 web projects? If so, then when & where should I use it?

Or perhaps 2 years ago, I was soo ignorant, that we used some kind of old version of asmx and we moved to new asmx.

P.S. As I was entering tag "asmx" I saw a message: "asmx is obsolete" : https://stackoverflow.com/tags/asmx/info

Community
  • 1
  • 1
dragonfly
  • 17,407
  • 30
  • 110
  • 219

4 Answers4

3

If you can work with WCF then yes the ASMX services are obsolete because the WCF can fully replace them with more performance and flexibility (multiple binding), functionality. If you can write a WCF service then if you will be requested to create an ASMX service for some reason there will be no problem for you to do it.

And moving from ASMX to ASHX was not a smart move because they are not for replacing each other.

Luke Girvin
  • 13,221
  • 9
  • 64
  • 84
Peter Kiss
  • 9,309
  • 2
  • 23
  • 38
  • 1
    Yes and i would not rewrite any ASMX service if it's working correctly. If an existing service would need some improvements then i'm sure i would rewrite the whole service with WCF technology (and ofcourse i will not write any new ASMX service). – Peter Kiss Oct 27 '12 at 13:58
2

Oddly we moved from ASMX to WCF and then back to ASMX. WCF has quite a few downsides, most of all is cross-platform compatibility issues. If everyone consuming your service is on .NET this isn't an issue, but not all other frameworks have supported the full stack, and frequently they just can't do what WCF produces. We also found that dealing with security and testing was a pain in WCF. If your webservice is marked secure, it has to be secure in WCF, even in your testing environment, which means getting actual SSL certs for each developer. A tremendous pain to be sure.

Kearns
  • 1,119
  • 7
  • 10
  • 2
    Cross-platform compatibility is not an issue in general with WCF. There may be _some_ cases where ASMX will work with certain non-compliant web services when WCF will not, at least not without customization. – John Saunders May 27 '15 at 20:06
0

ASMX and WCF are technologies to build web services in .NET. WCF was introduced in .NET 3.0. Its goal is to provide a standard abstraction over all communication technologies and is a recommended way of implementing web services in .NET.

What are the differences between WCF and ASMX web services?

ASHX is a way to write HTTPHandlers in .NET. For more information on what are HTTPHandler

http://forums.asp.net/t/1166701.aspx/1

ASMX services are supported in .NET. However migrating to WCF is recommended. Also, you should write all new services in WCF.

Community
  • 1
  • 1
Unmesh Kondolikar
  • 9,256
  • 4
  • 38
  • 51
  • @Eric - WebAPI is preferred for REST services, but if you have a need to write a SOAP service then WCF is the technology you'll use. WCF also introduces few advanced features that WebAPI won't support easily. – BornToCode Jan 25 '15 at 12:21
0

Yes, asmx is obsolute with WCF service. you can use asmx when you are working with < 4.0 aspx.

ashx will not be exact replace of asmx.

If you have coding format issue / standard / plenty of code then you can go with MVC Web API 2 (4.0 itself). but compare to WCF you must ensure what will be the recipient's response expectation ("WCF is the evolution of the web service(ASMX) and support various protocols like TCP, HTTP, HTTPS, Named Pipes, MSMQ. but Web api only for HTTP(s)").

Palani Kumar
  • 329
  • 4
  • 15