简体   繁体   中英

.Net Application Variables bleeding across applications

I have a couple of websites that have a shared code base as they are essentially the same website, except one is for the UK market and the other is for the US market. As well as sharing a code base, they also share a database with a very basic CMS so that each website can have some different content.

On the sites we have an admin page which can be used to set some HttpContext.Current.Application variables for each website, things that don't change all that often, but that we may want to change at a moments notice without having to update config files etc.

Now this has been working fine for a number of years now on a server 2003 box with IIS 6. Just yesterday we upgraded to a shiny new Server 2012 box with IIS 8 and we are now having issues with the Application objects.

To cut a long story short, now when an application variable is set on one website, it is being set across both sites, so the UK market sees the US application objects and vice versa, depending on which one was set last.

The application objects are pulled from a database based on a market code, and that is all working fine (the code hasn't changed in at least a couple of years now), and I have written some logging to confirm that the correct objects are being loaded for each website.

Each website has its own application pool, so I really can't see how this is happening. I have tested the sites on Server 2008 with IIS 7.5 and they behave fine there, similarly, I run a Windows 8 dev machine with IIS 8 with what I think is an identical setup to the new live servers (the app pools are configured the same and everything) and both sites do the correct thing there.

Has anyone ever heard of this sort of issue before, and does anyone have any suggestions for things I can look into to fix this? I thought it wasn't even possible to share Application objects across separate applications, are my assumptions wrong there?

Many thanks!

Mark

This sounds like a configuration problem, are you sure those site have different market codes? Looks like the queries returns wrong values for the application objects.

Ok, so it turns out, it was a configuration issue, not with the websites or even IIS. It in fact turned out that our sysadmin, when changing the DNS for the websites, accidentally changed the US website to the UK IP address, so both sites were the same application after all. I'm afraid it never even occurred to me to ping the sites to check the IP addresses, and we all now feel suitably silly for not spotting it sooner. I can only put it down to a ridiculously early start in the morning to do the change over, resulting in a bunch of over tired developers on a wild goose chase.

Still, if anyone else has a similar issue, perhaps this will help them.

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