C# IBodyModelValidator是否缺少类型映射?

C# IBodyModelValidator是否缺少类型映射?,c#,model-view-controller,asp.net-web-api,C#,Model View Controller,Asp.net Web Api,我发现下面的错误,可能是什么原因 我刚刚创建了一个新的控制器,其他控制器工作正常 Error: Resolution of the dependency failed, type = "System.Web.Http.Validation.IBodyModelValidator", name = "(none)". Exception occurred while: while resolving. Exception is: InvalidOperationException - The

我发现下面的错误,可能是什么原因

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

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;
                }
            }
可能我的问题不清楚,请告诉我。

我替换了

using System.Web.Mvc; 

它成功了

using System.Web.Http;