dki*_*fer 4 asp.net-web-api asp.net-web-api-helppages asp.net-web-api2
我无法弄清楚如何在我的Web Api中获取帮助页面以显示除None之外的资源描述.它链接了IHttpActionResult,然后是"无".之后.我通过添加config.SetActualResponseType(typeof(ComplexType), "Controller", "Action");
到HelpPageConfig.cs使我的示例工作.我的控制器看起来像这样:
/// <summary>
/// My description
/// </summary>
[Route("MyRoute")]
public IHttpActionResult Get()
{
try
{
//throw new Exception("TEST");
return Ok(returnValue);
}
catch (Exception ex)
{
*Company Log Method*
return NotFound();
}
}
Run Code Online (Sandbox Code Playgroud)
我不知道HelpPageConfig.cs或其他任何地方我缺少什么.也许一双新鲜的眼睛可以抓住一些东西.在此先感谢您的帮助!
我只需要在我的控制器顶部添加[ResponseType(typeof(MyModel))]
以上操作using System.Web.Http.Description;
.我现在得到我的模型的描述而不是IHttpActionResult和"None".
归档时间: |
|
查看次数: |
3882 次 |
最近记录: |