Is there a possibility to initialize a WebService.
I'm searching for a method that runs only during first call to WebService. Is there something like it in .Net ?
If you require "initialisation" the first time a given client connects to the Web Service:
Have an Initialise
method that returns a token, such a a GUID, that's then required on every call made to the actual "does the work" method of your web service. You can then ensure that for that client the service is always initialised.
If you require it the first time the web service is ever called:
Add some code to your service, as a private method, that is called at the top of each public method. Within it check for the existance of something, such as a registry entry, file, database record or other persistant value. If it doesn't exist, perform your initialisation and then create the "something".
If you require it on the first call since IIS last recycled/started the Application Pool:
Have a static constructor for the class so that when it's first instantiated the static constructor runs and performs your initialisation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With