Hi,
I am hosting a wcf service in IIS which provides necessary GUI interaction with data/MQ messaging, along with this I want one more thread to keep running for the complete life cycle of service. Job of this thread will be to see for any new message in MQ or look for any updates in database at certain time intervals and update local cache => static List<obj>, local cache will be used by WCF service based on client requests.
Steps :
1) Created WCF service, instance context Singleton, concurency Multiple.
2) On application start created and started a thread which polls MQ irrespective of any user request to service.
I have been able to do this, everything goes well for 30-40 minutes sometimes 2-3 hours with all the service and background threads running in parallel.(WCF request threads and back ground thread) -->I see logs wid different thread id whcih I am printing, based on that I am quoting this.
After a while at any anonymous point the background thread disappears from logs and I dont see any activity on that. During this my WCF service does not go down it still process user reuests from UI, only my background thread does not seem to be alive.
Everytime the background thread disappears at differnt point, there is no consistancy or pattern observed.
When my background thread disappears service does not go on app_error. I have even put try catch when I am starting a thread on app_start, it also does not catch anything. I also does not have any empty catch block which could be possibly catching any unhadled excpetion causing thread abort. I am unable to find what could be happening, is there a possiblity that app pool is killing the thread or anything like that ?
What I understnad is My Service is totally independent of the thread which I have created on Application_start.
Can someone please suggest/guide what could be happening ?