I'm trying to centralize some of the resources (images, css, footer etc)
into one website that all my apps can use. Simple things like images and
css would be a direct link (e.g. img
src=http://myresourcecenter.com/images/logo.gif) and some others would be a
web service call with the results to be cached by individual apps. The
problem is, if this resource website is down, all my web apps would cease to
work, so I need to put in a mirror site of it. I'm thinking of setting up
some sort of mechanism in these individual apps that can ping a page on the
resource website, say, every 60 seconds, if it doesn't get a response (e.g.
throws a WebException), it assumes the resource website is down and changes
the value of the global variable that holds the resource website URL to that
of the mirror site. Essentially a simple failover solution. The problem is
I'm not sure what's the best way to do this. I guess this "monitor" has to
be in the same thread as the web app so it can change the value for the
entire app, but the only way to fire the check regularly I can think of is
using Thread.Sleep(). This halts the entire web app though. So I need
something that doesn't interfere with the web app thread, and at the same
time can change a global value in the app. Could anyone comment on what
I'm thinking? whether this is doable, and possibly how?
Thanks a lot in advance.
Bob