Click here to Skip to main content
Click here to Skip to main content

Tagged as

Solving "The IControllerFactory 'MefContrib.Web.Mvc.CompositionControllerFactory' did not return a controller for the name xxx"

, 30 Jul 2014 CPOL
Rate this:
Please Sign up or sign in to vote.
Solving "The IControllerFactory 'MefContrib.Web.Mvc.CompositionControllerFactory' did not return a controller for the name xxx"

Solution

if you have this

        public virtual ViewResult Index(IService service)
        {
            return View();
        }

1) Make sure that the class that implements IService is decorated with the Export attribute:

[Export(typeof(IService)), PartCreationPolicy(CreationPolicy.NonShared)]
    public class ServiceImplementation : IService
    {}

2) Make sure there is no other class exporting the same contract:

[Export(typeof(IService)), PartCreationPolicy(CreationPolicy.NonShared)]
    public class AnotherServiceImplementation : IAnotherService
    {}

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Omar Gameel Salem
Software Developer
Australia Australia
Enthusiastic programmer/researcher, passionate to learn new technologies, interested in problem solving, data structures, algorithms, AI, machine learning and nlp.
 
Amateur guitarist/ keyboardist, squash player.
 
If you have a question\suggestion about one of my articles, or you want an algorithm implemented in C#, feel free to contact me.
Follow on   LinkedIn

Comments and Discussions

 
-- There are no messages in this forum --
| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.150301.1 | Last Updated 30 Jul 2014
Article Copyright 2014 by Omar Gameel Salem
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid