Note that there are some explanatory texts on larger screens.

plurals
  1. POProblem with custom controller factory
    primarykey
    data
    text
    <p>I've recently added Microsoft Unity to my MVC3 project and now I'm getting this error:</p> <blockquote> <p>The controller for path '/favicon.ico' could not be found or it does not implement IController.</p> </blockquote> <p>I do not really have a favicon.ico so I have no idea where that's coming from. And the weirdest thing is that the view is actually being rendered and THEN this error is being thrown... I am not sure if it's something wrong with my controller factory class because I got the code from some tutorial (I'm not to IoC - this is the first time I do that). Here's the code:</p> <p>public class UnityControllerFactory : DefaultControllerFactory { IUnityContainer container;</p> <pre><code>public UnityControllerFactory(IUnityContainer _container) { container = _container; } protected override IController GetControllerInstance(System.Web.Routing.RequestContext requestContext, Type controllerType) { IController controller; if(controllerType == null) throw new HttpException(404, string.Format("The controller for path '{0}' could not be found or it does not implement IController.", requestContext.HttpContext.Request.Path)); if(!typeof(IController).IsAssignableFrom(controllerType)) throw new ArgumentException(string.Format("Type requested is not a controller: {0}", controllerType.Name), "controllerType"); try { controller = container.Resolve(controllerType) as IController; } catch (Exception ex) { throw new InvalidOperationException(String.Format( "Error resolving controller {0}", controllerType.Name), ex); } return controller; } </code></pre> <p>}</p> <p>Any suggestions?</p> <p>Thanks in advance!</p>
    singulars
    1. This table or related slice is empty.
    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.
 

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