我的错误HelpController
:
HelpController 类型的构造函数包含名为“config”的参数和未注册的类型 HttpConfiguration。请确保 HttpConfiguration 已注册,或更改 HelpController 的构造函数。
有没有其他方法可以解决这个问题,因为我曾经Configuration
得到Configuration.GetModelDescriptionGenerator();
public class HelpController : Controller
{
private const string ErrorViewName = "Error";
public HelpController(HttpConfiguration config)
{
Configuration = config;
}
public HttpConfiguration Configuration { get; private set; }
...
public ActionResult ResourceModel(string modelName)
{
if (!String.IsNullOrEmpty(modelName))
{
ModelDescriptionGenerator modelDescriptionGenerator = Configuration.GetModelDescriptionGenerator();
ModelDescription modelDescription;
if (modelDescriptionGenerator.GeneratedModels.TryGetValue(modelName, out modelDescription))
{
return View(modelDescription);
}
}
return View(ErrorViewName);
}
}