XML
Web services can use Application object for managing the state.
Application object can be used as a shared container for state
management. Application object will allow us to store the variables or
object references that are available to all the visitors to the XML Web
service for the life time of the web service. Application object is
“in-process” which implies that it can run in the same process as
ASP.NET.
One difference to be noted between Session and Application is
Application object does not require the EnableSessionProperty to be set
in the webmethod attribute. Let us examine the code now. We do not set
the EnableSessionProperty = True as we did in Session object. Because Any class deriving from the Web service will have automatic access to the application object.
Another difference is we lock the Application to avoid concurrency issues. But this has a potential disadvantage of slowing up the Web service. Once we lock the application we block the other users to use the same object.
No comments:
Post a Comment