App Pool Explosion
Posted: Wed Jan 16, 2013 9:33 am
Hey all,
We just started using WURFL. We are currently tracking down an issue that causes our site to crash. The crash occurred after I added code to exclude Tablets from our mobile web app. When this code is commented out the problem goes away. So I have re-factored it a bit. Added a check to make sure the manager object is in the cache like it should be. We're going to put this new version up but I'd like to submit what I was doing in case I'm doing something horribly wrong.
In the Global.asax under Application_Start I placed the following:
Then in a parent controller I override the OnActionExecuting method and in there I place the following code:
We will be testing the above code this weekend to see if the new check for null makes any difference though I don't see how it could. Its like something is being allocated too much but since I'm using the Cache it should only be the one object right?
Should I be checking the value coming back from WURFLManagerBuilder.Build? The code functions fine and properly excludes the tablet devices that we've tested. Its just the resource issue and the App Pool explosion that happened after we restarted the server but doesn't seem to happen all the time.
We just started using WURFL. We are currently tracking down an issue that causes our site to crash. The crash occurred after I added code to exclude Tablets from our mobile web app. When this code is commented out the problem goes away. So I have re-factored it a bit. Added a check to make sure the manager object is in the cache like it should be. We're going to put this new version up but I'd like to submit what I was doing in case I'm doing something horribly wrong.
In the Global.asax under Application_Start I placed the following:
Code: Select all
var configurer = new ApplicationConfigurer();
var manager = WURFLManagerBuilder.Build(configurer);
HttpContext.Current.Cache[WurflManagerCacheKey] = manager;
Code: Select all
var manager = System.Web.HttpContext.Current.Cache[MvcApplication.WurflManagerCacheKey] as IWURFLManager;
if ( manager == null )
{
var configurer = new ApplicationConfigurer();
manager = WURFLManagerBuilder.Build(configurer);
System.Web.HttpContext.Current.Cache[MvcApplication.WurflManagerCacheKey] = manager;
}
var device = manager.GetDeviceForRequest(request);
if ( device.GetCapability("is_tablet") == "true")
{
Session["isMobile"] = _isMobile = false;
}
Should I be checking the value coming back from WURFLManagerBuilder.Build? The code functions fine and properly excludes the tablet devices that we've tested. Its just the resource issue and the App Pool explosion that happened after we restarted the server but doesn't seem to happen all the time.