1

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.

steve
  • 11
  • 1
  • Good question. If I understand right, you are saying that you are calling a method within the class, inside of the .asmx file, but not actually through a web service reference? Or are you? If you're not calling a web service reference, but calling a class inside of your project (which is also the web method) -- it's not going to serialize to HTTP. It's simply going to call the method. – George Johnston Jul 11 '11 at 15:17

1 Answers1

0

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.

antlersoft
  • 14,636
  • 4
  • 35
  • 55
  • Thank you for your answer. I am actually calling these as classes and not as true web services because this application started its life as a client-side application and I didn't want to redo all the code when I went to server-side controls. If I am calling them and using them as classes, would there still be a performance hit or not? – steve Jul 11 '11 at 15:33
  • If you are not going through a proxy, I don't understand why you are putting things in .ASMX files rather than just .cs files? – antlersoft Jul 11 '11 at 15:37
  • It was to save time because I may explore converting this to client-side again in the future. – steve Jul 11 '11 at 15:40
  • I see-- well, calling methods in .asmx files without going through a proxy is the same as calling any other method, so there is no overhead. – antlersoft Jul 11 '11 at 15:45