Wednesday, July 16, 2008

singleton and singlecall.

Remoting has support for both stateless and with-state environment, which is achieved using Singleton and Singlecall activation

Singleton types never have more than one instance at any one time. If an instance exists, all client requests are serviced by that instance.
Single Call types always have one instance per client request. The next method invocation will be serviced by a different server instance, even if the previous instance has not yet been recycled by the system.

If the operations are stateless, then using a singleton or single call wont really matter.
If you have any need to retain information between calls, you might
consider a singleton, as you will be able to store state in the singleton.

Difference between web services & remoting?

Remoting and Web Services are ways of communication between applications.

In Remoting, the applications involved in the communication process may be located on the same computer, different computers in a same or different network. A proxy of an application object is created on the other application.

Web Services - Communication between applications using web services is platform independent and programming independent. The application that consumes the web service, simply accesses it, without needing to know how this web service has actually been implemented & created.
It allows Distributed Applications to share Business Logic over Internet.
Differences between both:

1.Web Service are Stateless, whereas Remoting has support for both stateless and with-state environment, which is achieved using Singleton and Singlecall activation
2.ASP.NET provides good support to create Web Services. They are easy to deploy.Remoting is little complex.
3. In Remoting the applications involved in the communication should be built on .Net.
4.ASP.NET Web Services may be accessed using HTTP only. Remoting objects may be accessed over any protocol like TCP, SMTP, HTTP.