2
votes

I have a singleton WCF service hosted in IIS. I want to implement a store for persisting state for the service. I am writing my data to XML file.

Can you please tell me what is the recommended way of doing this? What events I can listen to while my WCF service unloads and reloads.

1
What kind of state do you want to save? Why do you have stateful / singleton service?Ladislav Mrnka
my service is a scheduler that has multiple timer instances. I am trying to know the behavior of the service when IIS restarts or host computer restarts or AppDomain reloads. I will need to persist state Correct?? I would like to recreate timers based on my stored state. Thanks.user96403
What are your real requirements ? So far, it doesn't sound like a singleton is a good approach, so asking the recommended way of persisting singleton state is not going to get you the best end result.markt
I want the timer configurations, service state to be persisted. I think Durable service can help.user96403

1 Answers

4
votes

Based on your comment the only valid approach is persisting service state each time the configuration changes - it means in each request changing the setting. Otherwise after each unexpected termination of the AppDomain you will lose last configuration.