【发布时间】:2015-09-24 15:45:10
【问题描述】:
当我运行我的程序时,它只显示“在此处提供您的 API 的一般描述”。但没有显示内容。就像这张图:http://i.stack.imgur.com/unBmb.png
我的问题与ASP.NET Web Api Help Page doesn't show any tips 类似,但没有提供任何解决方案。
我已按照“将帮助页面添加到现有项目”中的本教程http://www.asp.net/web-api/overview/getting-started-with-aspnet-web-api/creating-api-help-pages 进行操作,并且所有内容都是从 nuGet 自动创建的,“ValuesController”除外。
我猜这就是问题所在。
我的价值观控制器:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
namespace WebApiHelperTest.Controllers
{
public class ValuesController : ApiController
{
/// <summary>
/// Gets some very important data from the server.
/// </summary>
public IEnumerable<string> Get()
{
return new string[] { "value1", "value2" };
}
/// <summary>
/// Looks up some data by ID.
/// </summary>
/// <param name="id">The ID of the data.</param>
public string Get(int id)
{
return "value";
}
// POST api/values
public void Post([FromBody]string value)
{
}
// PUT api/values/5
public void Put(int id, [FromBody]string value)
{
}
// DELETE api/values/5
public void Delete(int id)
{
}
}
}
有没有人对此有解决方案,或者有任何关于哪里可能出错的建议?
(我还创建了一个新的 asp.net web api-project(其中包含从一开始的 valuescontroller),这工作正常..)
【问题讨论】:
标签: c# asp.net asp.net-mvc asp.net-web-api-helppages