[英]Is there a way to force IIS to invoke CustomServiceHost?
All, 所有,
I have developed a WCF Web Service and hosted it in IIS7.5. 我已经开发了WCF Web服务并将其托管在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. 服务行为是instanceContextMode=InstanceContextMode.PerSession
,因此IIS在第一个请求期间创建一个服务实例,并创建与请求数量一样多的实例。
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. 我确实尝试过使用CustomServiceFactory并自己承担创建服务工厂实例的负担。 But looks like the IIS will create the service factory as well during first request or I am not sure on this part. 但是看起来IIS也会在首次请求期间创建服务工厂,或者我不确定这部分内容。
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? 因此,我想知道在IIS中部署应用程序或在IIS重新启动期间如何创建服务实例/服务工厂实例吗?
Any help is much appreciated! 任何帮助深表感谢!
We are using the auto-start feature of AppFabric to initialize the services on application startup/app pool recycle. 我们正在使用AppFabric的自动启动功能在应用程序启动/应用程序池回收时初始化服务。 It invokes each service inside the application once during application start. 在应用程序启动期间,它一次调用应用程序内部的每个服务。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.