Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>If you are working from Steven Sanderson's book, Pro ASP.Net MVC Framework, then you'll need to make a change to the WindsorControllerFactory class to work with the interface exposed by the DefaultControllerFactory. This class was updated in the MVC 2 Preview 2. Who knows what the final release will hold.</p> <p>Change:</p> <pre><code>protected override IController GetControllerInstance(Type controllerType) </code></pre> <p>To:</p> <pre><code>protected override IController GetControllerInstance(RequestContext requestContext, Type controllerType) </code></pre> <p>I've also found it necessary to ensure that the MVC 2 Preview 2 framework hasn't passed in a non-controller class (it was unexpectedly passing in favicon.ico as the controllerType). So the updated GetControllerInstance method looks like this:</p> <pre><code>protected override IController GetControllerInstance(RequestContext requestContext, Type controllerType) { //Debug.Print("Controller: {0}, Action: {1}", requestContext.RouteData.Values["Controller"], requestContext.RouteData.Values["Action"]); if (controllerType == null) { //Debug.Print("Is IController: {0}", (controllerType is IController)); //Debug.Print("Is null: {0}", (controllerType == null)); return null; } else { return (IController)container.Resolve(controllerType); } } </code></pre> <p>I left the Debug code in there in case you're interested in seeing why you're getting a "Value cannot be null" error in the WindsorControllerFactory.</p> <p>After making this change, Windsor began working for me. Hopefully, this will help.</p> <p>Cheers, Jason</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload