小编Rog*_*ger的帖子

结构图Web Api 2帐户控制器和个人帐户

我非常喜欢IOC和web-api 2,但是我已经在我的web-api 2中使用了StructureMap来处理我自己的控制器.我没有管理的是使用个人帐户在AccountController上使用StructureMap.我使用AccountController开箱即用,到目前为止我所管理的是:

  1. 在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"

c# structuremap owin asp.net-web-api2

7
推荐指数
1
解决办法
2025
查看次数

标签 统计

asp.net-web-api2 ×1

c# ×1

owin ×1

structuremap ×1