Hi,
thanks you so much for your answer. I think I have done quite a few design
mistakes when creating my webservice. My webservice is mostly returning
typed datasets with data from a database. I have one webservice file:
data.asmx with database connection, dataadapters and datasets and methods to
return datasets to the client and save data in datasets from the client to
the database. Do you have any advice for me for a better way to design this
application? I understand I should move the database connection to the
global file, but what about dataadapters and datasets? It would be faster to
initialize those only once too I suppose. Hence the data.asmx would only
contain the functions to work with the datasets from the global file.
How do I work with objects from the global.asax file in data.asmx? Can I
reference them as local objects?
Thank you so much for your time and answers! I hope you are willing to share
your knowledge with me :)
Cheers,
Trygve
"Sami Vaaraniemi" <sa**********@p leasejippii.fi> wrote in message
news:u$******** ******@tk2msftn gp13.phx.gbl...
"Trygve Lorentzen" <trygveloAThald enDOTnet> wrote in message
news:uq******** ******@tk2msftn gp13.phx.gbl... Hi,
I don't know if this is a stupid question, but I observe that my webservice is created for each call to a webmethod. More precisely an instance of
the webservice class is created for each call. This makes the
InitializeCompo nent() method run for each method call and seems to
really slow things down. Can I keep the webservice object running after a
method call?
This is the way it works: since Web Services are (supposed to be)
stateless, a new instance is created on every call.
If you have some heavy initialization to do that you want to do only once,
do the initialization from within the Application_Sta rt handler in the
Global class.
Regards,
Sami