我非常喜欢IOC和web-api 2,但是我已经在我的web-api 2中使用了StructureMap来处理我自己的控制器.我没有管理的是使用个人帐户在AccountController上使用StructureMap.我使用AccountController开箱即用,到目前为止我所管理的是:
在Ioc.cs中我添加了以下内容(由于错误)
x.For<IUserStore<ApplicationUser>>().Use<UserStore<ApplicationUser>>();
x.For<DbContext>().Use(() => new ApplicationDbContext());
x.For<ISecureDataFormat<AuthenticationTicket>()
.Use<SecureDataFormat<AuthenticationTicket>>();
Run Code Online (Sandbox Code Playgroud)但是现在我遇到了这个错误:
"没有注册默认实例,无法自动确定类型IDataSerializer <AuthenticationTicket>"
我真的不知道该怎么做.我试图找到IDataSerializer的详细实例,但没有运气.
顺便说一句......我已经安装了Nuget包"Structuremap.webapi2"