Web服务与类文件 - 性能 [英] Web service vs. class file - performance

查看:119
本文介绍了Web服务与类文件 - 性能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图找出最好的方法去做这个:我正在开发一个项目,我把所有我的数据访问层代码到.ASMX文件,以保持它们与我的表示层分离。我从代码中调用我的所有方法,并使用Web服务,如类文件。我基于另一个开发人员的工作遵循这种做法。有两个意见到此为止:一个说,当代码隐藏从Web服务调用方法,这是一个性能命中,因为它必须做一个HTTP请求,另一个说,没有性能命中。 ASMX文件在同一服务器上的同一项目中。是真的有性能打击还是不是真的?我倾向于不认为。



对此有任何帮助或意见。

解决方案

如果您调用作为Web服务,您仍然必须通过代理和参数编组,即使您在同一服务器内调用;相比直接调用相同的类有一个性能命中;呼叫开销可以高几个数量级。如果被调用方法没有做大量工作,你不会这样做。


I am trying to figure out the best way to go about doing this: I am working on a project and I'm putting all my data access layer code into .ASMX files to keep them separated from my presentation layer. I am calling all my methods from the code behind and using the web services like class files. I am following this practice based on one other developer's work. Two opinions on this so far: One says when the code-behind calls the method from the web service, it's a performance hit because it has to go do an HTTP request and the other says, no performance hit. The ASMX files are within the same project on the same server. Is there indeed a performance hit or not really? I tend to think not.

Any help or opinion on this would be appreciated.

解决方案

If you call as a web service, you still have to go through the proxy and argument marshalling even if you are calling within the same server; there is a performance hit compared to calling the same class directly; the call overhead may be orders of magnitude higher. You wouldn't want to do this if the called method isn't doing some substantial work.

这篇关于Web服务与类文件 - 性能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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