Constructor in a web service
-
I have an application in a Windows forms and I want to export it to a web service. In my application, there is some initialization done in the constructor of my windows form, as well as in the Load event handler. Obviously, this code executes only once, that is, at the beginning of the program. I've started to port this application to a Web Service, but I realised that the code in the constructor (where the InitializeComponent is) executes every time I call a function with the Invoke button of the testing interface. My initialization code is somewhat long and it simply cannot be that way... Is there a way to make my initialization code execute only once, just like it does in a Windows Form? Thank you very much!
-
I have an application in a Windows forms and I want to export it to a web service. In my application, there is some initialization done in the constructor of my windows form, as well as in the Load event handler. Obviously, this code executes only once, that is, at the beginning of the program. I've started to port this application to a Web Service, but I realised that the code in the constructor (where the InitializeComponent is) executes every time I call a function with the Invoke button of the testing interface. My initialization code is somewhat long and it simply cannot be that way... Is there a way to make my initialization code execute only once, just like it does in a Windows Form? Thank you very much!
haven't done much work with web services but I think they have a Global.asax file much like a web site. Add this to the project (there should be an option for it in the add object dialogue) and it'll generate several methods one of which is Application_Start.