简体   繁体   中英

Is there a way to force IIS to invoke CustomServiceHost?

All,

I have developed a WCF Web Service and hosted it in IIS7.5. The service behavior is instanceContextMode=InstanceContextMode.PerSession and hence IIS creates an service instance during the first requests and creates as many instances as the number of requests.

But there is a requirement to cache some of the application data upfront before the service is invoked ie., similar to static initialization.

I don't want to disturb the service behavior attributes but want to achieve the static initialization.

I did try to use CustomServiceFactory and take up the load of creating service factory instances myself. But looks like the IIS will create the service factory as well during first request or I am not sure on this part.

So, I would like to know how to create the service instance / service factory instance when the application is deployed in IIS or during IIS restart?

Any help is much appreciated!

We are using the auto-start feature of AppFabric to initialize the services on application startup/app pool recycle. It invokes each service inside the application once during application start.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM