当前类型是接口,无法构造.您是否缺少类型映射? [英] The current type, is an interface and cannot be constructed. Are you missing a type mapping?

查看:75
本文介绍了当前类型是接口,无法构造.您是否缺少类型映射?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么不起作用?

这是我的控制器.

public class OperatorsController : BaseController
{
    private readonly IOperatorService userService;
    public OperatorsController(IOperatorService userService)
    {
        this.userService = userService;
    }

    public ActionResult Index()
    {
        return View();
    }
}

推荐答案

您应该探索

You should explore the answers to this question. You likely have forgotten to map IOperatorService to a concrete class in your Unity container.

这篇关于当前类型是接口,无法构造.您是否缺少类型映射?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆