开发者

Could not resolve serviceType [controller name]

开发者 https://www.devze.com 2022-12-14 02:13 出处:网络
When trying to refactor an existing asp.net-mvc application to use Turbine as an IoC I get the following result:

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())
{
  开发者_JS百科  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.


Do you miss a registration for the SearchController?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号