在我的NinjectWebCommon.cs
文件中,根据CreateKernel
我正在应用这样的注入的方法
private static IKernel CreateKernel()
{
var kernel = new StandardKernel();
kernel.Bind<Func<IKernel>>().ToMethod(ctx => () => new Bootstrapper().Kernel);
kernel.Bind<IHttpModule>().To<HttpApplicationInitializationHttpModule>();
RegisterServices(kernel);
// Web API Injection
GlobalConfiguration.Configuration.DependencyResolver = new NinjectDependencyResolver(kernel);
// SignalR Injection
GlobalHost.DependencyResolver = new SignalR.Ninject.NinjectDependencyResolver(kernel);
return kernel;
}
我在想应该为我做这件事,但我在 SignalR 注入时不断收到错误消息
“不能将类型‘SignalR.Ninject.NinjectDependencyResolver’隐式转换为‘Microsoft.AspNet.SignalR.IDependencyResolver’”
知道问题是什么吗?