【问题标题】:IBodyModelValidator Are you missing a type mapping?IBodyModelValidator 您是否缺少类型映射?
【发布时间】:2015-08-25 10:08:25
【问题描述】:

我遇到错误,可能是什么原因。

我刚刚创建了一个新控制器,其他控制器工作正常。

Error:

Resolution of the dependency failed, type = "System.Web.Http.Validation.IBodyModelValidator", name = "(none)".

Exception occurred while: while resolving.

Exception is: InvalidOperationException - The current type, System.Web.Http.Validation.IBodyModelValidator, is an interface and cannot be constructed. Are you missing a type mapping?

-----------------------------------------------

At the time of the exception, the container was:



  Resolving System.Web.Http.Validation.IBodyModelValidator,(none)

它落在线以下。

public object GetService(Type serviceType)
        {
            if (this.Container == null)
            {
                throw new ObjectDisposedException("this", "This scope has already been disposed.");
            }

                try
                {
                    return this.Container.Resolve(serviceType);
                }
                catch (ResolutionFailedException)
                {
                    return null;
                }
            }

可能我的问题不清楚,请告诉我。

【问题讨论】:

    标签: c# model-view-controller asp.net-web-api


    【解决方案1】:

    我换了

    using System.Web.Mvc; 
    

    using System.Web.Http;
    

    它成功了。

    【讨论】:

      猜你喜欢
      • 2012-04-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-11
      • 2011-12-30
      • 1970-01-01
      相关资源
      最近更新 更多