Castle.Windsor help needed

Offhand, does anybody know why a simple WindsorControllerFactory would work while in the IDE, but not once published? For the life of me I can’t figure this one out. When the solution is run in the IDE, it resolves everything fine, but when I ran a test installation on my server, it couldn’t resolve the controllers. Both odd, and bad, as this is a client project I’m working on.

Hmmm. Beyond making sure all the DLLs are uploaded and the Web.config is correct, I’m out of ideas. I wish I didn’t have such simplistic answers, I really would like to be able to help the way you always help me. :slight_smile:

Thanks dude. I did manage to fix it. There’s just one problem. I don’t know what the reason is. Here are the before and afters. The odd thing is that the before code works while running in the IDE but not on a live install. It is possible that going live actually affected another aspect, which in turn cased a null where there shouldn’t be, but I’m not in a position to trace it out right now. So I’m left completely stumped. At least I have a workaround.

Before:

protected override IController GetControllerInstance(RequestContext requestContext, Type controllerType)
{    try
    {
        // see if windsor can do it
        return _container.Resolve(controllerType) as IController;
    }
    catch // if not
    {
        try
        {
            // see if base can do it
            return base.GetControllerInstance(requestContext, controllerType);
        }
        catch // if not
        {
            return null;
        }
    }
        
}

After:

protected override IController GetControllerInstance(RequestContext requestContext, Type controllerType)
{
    // catch nulls right away
    if (controllerType == null)
        return null;
    try
    {
        // see if windsor can do it
        return _container.Resolve(controllerType) as IController;
    }
    catch // if not
    {
        // see if base can do it
        return base.GetControllerInstance(requestContext, controllerType);
    }
        
}