SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    Resident OCD goofball! bronze trophy Serenarules's Avatar
    Join Date
    Dec 2002
    Posts
    1,911
    Mentioned
    26 Post(s)
    Tagged
    0 Thread(s)

    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.

  2. #2
    Chopped Liver bronze trophy imaginekitty's Avatar
    Join Date
    Aug 2007
    Location
    Pennsyltucky
    Posts
    1,494
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    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.

  3. #3
    Resident OCD goofball! bronze trophy Serenarules's Avatar
    Join Date
    Dec 2002
    Posts
    1,911
    Mentioned
    26 Post(s)
    Tagged
    0 Thread(s)
    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:
    Code:
    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:
    Code:
    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);
        }
            
    }


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •