asp.net Web服务和Ihttphandler的区别 [英] Difference asp.net web service and Ihttphandler

查看:82
本文介绍了asp.net Web服务和Ihttphandler的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

诸如AJAX请求,传递一个参数并返回结果之类的简单任务可以使用Web Service和IHttpHandler来完成,那么区别在哪里?

Simple task like make AJAX request , pass one parameter and return result, can be done with Web Service and IHttpHandler, so where is the difference ?

推荐答案

ASP.NET Web服务实际上是一种HttpHandler,它提供基于W3C标准(SOAP/WSDL)的基于XML的通信基础结构.这意味着非.NET客户端可以与ASP.NET Web服务进行互操作.如果您要发出非常简单的单个ajax请求以返回简单结果,则ASP.NET/XML Web服务可能会显得过时.

ASP.NET web services are in fact a type of HttpHandler that provide an XML based communication infrastructure based on W3C standards (SOAP/WSDL). This means that non .NET clients can interoperate with ASP.NET web services. In your case where you're making a very simple single ajax request to return a simple result, ASP.NET/XML web services may be overkill.

实现简单的自定义HttpHandler而不是调用与ASP.NET Web服务相关的所有管道和开销可能更有益/高效.使用自定义的HttpHandler,您可以发送所需的参数,并完全返回您想要查看的结果,而无需使用XML Web服务时会创建的任何支持SOAP xml.

It may be more beneficial/efficient to implement a simple custom HttpHandler rather than invoking all of the plumbing and overhead associated with ASP.NET web services. With a custom HttpHandler you can just send the parameter you need and return exactly the result you want to see without any of the supporting SOAP xml that would be created when using XML web services.

这篇关于asp.net Web服务和Ihttphandler的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆