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));
        }

 

 

posted @   Gyoung  阅读(463)  评论(0编辑  收藏  举报
努力加载评论中...
点击右上角即可分享
微信分享提示