简体   繁体   English

asmx到WCF或Web API

[英]asmx to WCF or Web API

I have an application that I'm building and for the moment, I built some web services using ASMX. 我有一个我正在构建的应用程序,目前,我使用ASMX构建了一些Web服务。 In the end, the application will be deployed on azure. 最后,应用程序将部署在azure上。 The web services are really simple in that all they do is call a class in the AppCode folder that handles all the work. Web服务非常简单,他们所做的只是在AppCode文件夹中调用一个处理所有工作的类。

Is it going to be better/easier/faster/more performant to move my web services to WCF or to Web API? 将我的Web服务移动到WCF或Web API会更好/更容易/更快/更高效吗?

Thanks for your suggestions. 谢谢你的建议。

PS: I want to add that the web services will need to work in HTTPS. PS:我想补充一点,Web服务需要在HTTPS中工作。 At the moment, they're on HTTP because I'm in development mode. 目前,他们在HTTP上,因为我处于开发模式。

One-liner: if you have already got a working code and it is risky to move it to another technology stay with the working code. One-liner:如果你已经有了一个正常工作的代码,那么使用工作代码将其转移到其他技术是有风险的。

Depends who is answering. 取决于谁在回答。

Web API embraces HTTP and gives you flexibilities not possible with ASMX and WCF. Web API包含HTTP,并为您提供ASMX和WCF无法实现的灵活性。 If you care about HTTP, content-negotiation, media types and you need your service to be called from any client (including AJAX) then Web API. 如果您关心HTTP,内容协商,媒体类型,您需要从任何客户端(包括AJAX)和Web API调用您的服务。

If you need to be able to use WS* security standards (eg using X509 certificates, ADFS, etc), possibly change your binding, serve to different clients using different bindings, extensibility, etc use WCF. 如果您需要能够使用WS *安全标准(例如,使用X509证书,ADFS等),可能会更改绑定,使用不同的绑定,可扩展性等服务于不同的客户端使用WCF。

If you already have a working code, and all you care about is RPC and your clients are always going to use ASMX then stick with ASMX. 如果你已经有了一个正常工作的代码,而你所关心的只是RPC而你的客户总是要使用ASMX,那么坚持使用ASMX。

Performance 性能

No benchmark but my gut feeling, in descending order: Web API, ASMX, WCF 没有基准,但我的直觉,按降序排列:Web API,ASMX,WCF

Easier 更轻松

In descending order: ASMX (since you know it), Web API, WCF 按降序排列:ASMX(因为你知道),Web API,WCF

Faster development 加快发展

If you know them all, Web API and ASMX then WCF 如果你完全了解它们,那么Web API和ASMX就是WCF


PS: it is good to pick up new technologies. PS:采用新技术很好。 The way things are going (and since you are already moving to Azure) it is important to invest on new technologies. 事情的发展方向(因为你已经转向Azure),重要的是投资新技术。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM