【发布时间】:2017-05-20 16:10:14
【问题描述】:
我正在尝试关注文章Build RESTful API's with ASP.NET Web API 来学习如何创建 RESTful API。
我创建了第一个项目和控制器,Contact。
public class ContactController : Controller
{
// GET: Contact
public string[] Index()
{
return new string[]
{
"Hello",
"World"
};
}
}
但是当我在浏览器中加载 URL 时,并没有得到文章中描述的响应 (["Hello","World"])。我得到的回复是System.String[]。
我不明白我错过了什么。
顺便说一句,这篇文章是 2013 年的。有谁知道一篇可能更新一点的好文章?
【问题讨论】:
标签: c# asp.net asp.net-mvc rest asp.net-web-api