这一行:
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: