在主项目和引用项目中使用 Ninject
Use Ninject in both main and referenced projects
我有 MVC4 网站项目和 WCF 项目,都使用 Ninject。
我想在网站项目中使用 WCF 项目中的 class。我添加对项目的引用并同时执行 NinjectWebCommon.Start()
(有 "The static container already has a kernel associated with it!" 错误)。
有没有办法制作我想要的东西?
在参考项目中使用这个启动解决了这个问题
public class Global : NinjectHttpApplication
{
protected override IKernel CreateKernel()
{
return new StandardKernel(new ServiceModule());
}
}
我有 MVC4 网站项目和 WCF 项目,都使用 Ninject。
我想在网站项目中使用 WCF 项目中的 class。我添加对项目的引用并同时执行 NinjectWebCommon.Start()
(有 "The static container already has a kernel associated with it!" 错误)。
有没有办法制作我想要的东西?
在参考项目中使用这个启动解决了这个问题
public class Global : NinjectHttpApplication
{
protected override IKernel CreateKernel()
{
return new StandardKernel(new ServiceModule());
}
}