这一行:
container.Register<IPrincipal>().UsingConstructor(() => HttpContext.Current.User);引发以下异常:
不能注册类型System.Security.Principal.IPrincipal -抽象类或接口不是SingletonFactory的有效实现类型。 描述:在执行当前web请求时发生了未处理的异常。请查看堆栈跟踪以获得有关错误的更多信息,以及它起源于代码的位置。 异常详细信息: Tss.Rhnncp.DietPlanner.Bootstap.TinyIoCRegistrationTypeException:不能注册类型System.Security.Principal.IPrincipal -抽象类或接口不是SingletonFactory的有效实现类型。
源错误:
Line 2663: throw new TinyIoCRegistrationTypeException(registerImplementation, "SingletonFactory");
Line 2664:
Line 2665: if (!IsValidAssignment(registerType, registerImplementation))
Line 2666: throw new TinyIoCRegistrationTypeException(registerImplementation, "SingletonFactory");
Line 2667:发布于 2014-08-15 06:18:32
我不熟悉TinyIoc,但我希望您需要这样的东西:
container.Register<IPrincipal>(() => HttpContext.Current.User);https://stackoverflow.com/questions/25319958
复制相似问题