2014-03-18 66 views
0

我目前沒有問題注入從ApiController繼承的控制器。但是,當我嘗試標準控制器時,會出現有關無參數構造函數的錯誤。Web API和DI與控制器

我理解,以下:

GlobalConfiguration.Configuration.DependencyResolver = new NinjectResolver(kernel); 

只設置噴射用於控制器從ApiController繼承。

我的問題是,我需要做什麼來使控制器繼承形式的控制器類來訪問Ninject解析器?

+0

可能的複製,檢查這個答案我給http://stackoverflow.com/questions/21520417/share-a-kernel-between-webapi-and-mvc/21528440#21528440 – cvbarros

+0

您正在使用的NuGet安裝ninject?什麼是包名? – sunil

回答