找到我這麼新的single page application
。我創建一個webapi
,你可以在這裏看到:API控制器不能在瀏覽器中的MVC asp.net
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Data.Entity.Infrastructure;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using System.Web.Http.Description;
using WebApplication6.Models;
namespace WebApplication6.Controllers
{
public class ManageStudentInforAPIController : ApiController
{
private SchoolManagementEntities db = new SchoolManagementEntities();
// GET: api/ManageStudentsInfoAPI
public IQueryable<Student> Get()
{
return db.Students;
}
}
}
但是,當我把這個網址http://localhost:5411/ManageStudentInforAPI
結果是
The resource cannot be found.
Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly.
Requested URL: /ManageStudentInforAPI
哪裏是我的問題.ANY細節你需要我可以post.i正在使用vs2015
請添加您的路由配置。默認api已達到'api/controller' – Hypnobrew