Could not resolve serviceType [controller name]

152 views Asked by At

When trying to refactor an existing asp.net-mvc application to use Turbine as an IoC I get the following result:

MvcTurbine.ComponentModel.ServiceResolutionException 
Could not resolve serviceType 'CommonProject.Web.Shared.Controllers.SearchController' 
Source Object: at MvcTurbine.Unity.UnityServiceLocator.Resolve[T](Type type)

The (only) ctor for my SearchController looks like this

public SearchController(ISearchService searchService):base(new SearchViewData())
{
    this.searchService = searchService;
}

And my registration looks like this

public class SearchServiceRegistration: IServiceRegistration
{
    public void Register(IServiceLocator locator)
    {
        locator.Register<ISearchService>(typeof(LuceneSearchService));
    }
}

UPDATE

I found it (it was a bit stupid)

locator.Register<ISearchService>(typeof(LuceneSearchService));

should have been

locator.Register<ISearchService,LuceneSearchService>();

Don't know what the first syntax is supposed to do though.

1

There are 1 answers

1
HackerBaloo On

Do you miss a registration for the SearchController?