My WeApp works fine but then 10 or 20 minutes later it fall. Because Microsoft Unity (v3.0) don't have a registered class to match with some interface..
The problem happens when the web is deployed in the server. I don't know maybe the session issue or something like that...
I'm using Unity 3.0 as IOC and Asp.net Mvc5....In my local pc all works fine...when I deploy the solution in a server with IIS7. All works fine, but 10 or 20 minutes later unity don't recognize the matches types... If I stop the server and start again the problems happens again.
--------------------------------------------------------------------------------------------------------------------------------------------
I'm using the unity controller factory:
public class UnityControllerFactory : IControllerFactory
{
private IUnityContainer _container;
private IControllerFactory _innerFactory;
public UnityControllerFactory(IUnityContainer container)
: this(container, new DefaultControllerFactory())
{
}
public static void RegisterComponents()
{
var container = new UnityContainer();
AppInjections.Register(container);
DependencyResolver.SetResolver(new UnityDependencyResolver(container));
var factory = new UnityControllerFactory(container);
ControllerBuilder.Current.SetControllerFactory(factory);
}
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
This is my controller:
public class MyController : Controller
{
private GeneratorAlpha _generator;
private FinderBeta _finder;
20 minutes is the default time out for session, so is it 10 minutes or 20 minutes.
Are you using any global filters to handle session timeout?
Are you getting an exception, with full stack trace?
foxhardx
ASKER
Hi Bob,
I think the problem is caused because I have load unity configuration in global.asax. Then, when the web is recycled, that section does not load anymore. I guess I have move this line: "UnityConfig.RegisterComponents();" to another event what load in each request. What do you think?
public class MvcApplication : System.Web.HttpApplication
{
protected void Application_Start()
{
AreaRegistration.RegisterAllAreas();
RouteConfig.RegisterRoutes(RouteTable.Routes);
UnityConfig.RegisterComponents(); // <-------------------------------- Unity Registration
}
}
Bob Learned
If this is happening when the session ends, are you looking to handle that gracefully, like redirect to a "session end" page?