我在此处没有答案,仅使用Unity.
I'm having same issue described here with no answer, just using Unity.
我正在尝试在最新的VS2013(更新2)SPA/Web Api模板中注册ISecureDataFormat<>.
I'm trying to register ISecureDataFormat<> in the lastest VS2013 (update 2) SPA/Web Api template.
我尝试过
container.RegisterType(typeof(ISecureDataFormat<>), typeof(SecureDataFormat<>)); container.RegisterType<ISecureDataFormat<AuthenticationTicket>, SecureDataFormat<AuthenticationTicket>>(); container.RegisterType<ISecureDataFormat<AuthenticationTicket>, TicketDataFormat>();它起作用",但不是真的,因为它随后抱怨该树中的下一个依赖关系,即IDataSerializer ...,然后是下一个IDataProtector,但我没有实现.
It "works" but not really because then it complains about the next depenedency in that tree, IDataSerializer... and then the next IDataProtector, for which I found no implementation.
推荐答案我通过以下映射解决了SimpleInjector中的以下错误
I solved the following error in SimpleInjector with the following mappings
container.Register<IDataSerializer<AuthenticationTicket>, TicketSerializer>(); container.Register<IDataProtector>(() => new DpapiDataProtectionProvider().Create("ASP.NET Identity"));要弄清楚使用了什么序列化程序,我注意到AccountsController中的ISecureDataFormat通用参数是AuthenticationTicket类型.在检查IDataSerializer命名空间时,TicketSerializer实现IDataSerializer.
To figure out what serializer was used I noticed that the ISecureDataFormat generic parameter in the AccountsController was a AuthenticationTicket type. In checking the IDataSerializer namespace the TicketSerializer implements IDataSerializer.
要弄清楚IDataProtector,我再次查看了IDataProtector命名空间,并找到了IDataProtectionProvider的实现.
To figure out IDataProtector I again looked in the IDataProtector namespace and found the implementation of the IDataProtectionProvider.
更多推荐
ASP.NET Identity 2
发布评论