Activation error occured while trying to get instance of type IAuthServices, key ""
在用Microsoft.Practices.ServiceLocation.Current.GetInstance<IAuthServices>()获取一个对象的实例的时候报错,说是key没有找到。应该就是没有注册,后来调试果然是。
在初始化的地方Bootstrapper加上注册就可以了
protected override void ConfigureAggregateCatalog() { this.AggregateCatalog.Catalogs.Add(new AssemblyCatalog(typeof(Bootstrapper).Assembly)); this.AggregateCatalog.Catalogs.Add(new AssemblyCatalog(typeof(Frame.Security.Service.AuthServices).Assembly)); }
如果我的文章对你有帮助,就点一下推荐吧.(*^__^*)

浙公网安备 33010602011771号