Control over a static variable in a wcf

R

Robert Pettersson

Hi,

I have an object that takes 30-60 seconds to create/instanciate and I want
to use it for all users in my website.

I first thought about storing it in a cache or something, but since it is
not serializable that was not possible.

So I have created a singelton function of my object so that my webservice
will have it as an static varibla,but since it takes
so long to create the static variable I want to have control over when it is
created.

The static variable will live inside one of my webservices and I would like
to create it when the application starts.
I could use global.asax and the app_init or app_start events. But then it
will be created on the first time the application
is accessed not started. That would make the first user experience bad. And
I would like to know that the instance exists the
first time a user a accesses the site.

Is there any way I can do this? Could I do this with some function in IIS
combined with code (like App_Init or Start) or would
it help me if I created my own webservice host, like a winapp or winservice?
Or would I loose a lot of functionality by not
hosting my service in IIS?

Would be very greatful for suggestions on possible solutions to my problem.

Thanks

/Robert
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top