No se pudo cargar el recurso: el servidor respondió con un estado de 404 (no encontrado)

Estoy usando el tutorial de la universidad de Contoso y estoy tratando de modificarlo con este tutorial:

https://www.youtube.com/watch?v=B59skvlroyc

Cuando terminé, veo este error en el inspector del navegador (F12)

https://www.dropbox.com/s/wy1c6ocxxbke1f2/error.jpg?dl=0

No se pudo cargar el recurso: el servidor respondió con un estado de 404 (no encontrado)

¿Alguien podría explicar dónde está el problema?

Controlador:

public PartialViewResult Top3()
        {
            List<Student> model = Students.OrderByDescending(s => s.Enrollments.Select(s => s.Course.Credits)).Take(3).ToList();
            return PartialView("_Student", model);
        }

Vista de índice:

@model PagedList.IPagedList<ContosoUniversity.Models.Student>
@using PagedList.Mvc;
<link href="~/Content/PagedList.css" rel="stylesheet" type="text/css" />
<script src="../Scripts/jquery-1.8.0.min.js"></script>
<script src="~/Scripts/jquery.unobtrusive-ajax.min.js"></script>
@{
    ViewBag.Title = "Students";
}

<h2>Students</h2>

<p>
    @Html.ActionLink("Create New", "Create")
</p>

@using (Html.BeginForm("Index", "Student", FormMethod.Get))
{
    @Html.AntiForgeryToken()
    @Html.ValidationSummary(true)
    <p>
        Find by name: @Html.TextBox("SearchString", ViewBag.CurrentFilter as string)

        Enrollment: 

        <input type="submit" value="Filter" />
    </p>
}

<table class="table">
    <tr>
        <th>
            @Html.ActionLink("Last Name", "Index", new { sortOrder = ViewBag.NameSortParm })
        </th>
        <th>
            First Name
        </th>
        <th>
            @Html.ActionLink("Enrollment Date", "Index", new { sortOrder = ViewBag.DateSortParm })
        </th>
        <th>
            Date Of Birth
        </th>
        <th>
            Courses
        </th>
        <th>
            Credits
        </th>
        <th></th>
    </tr>

@foreach (var item in Model) {
    <tr>
        <td>
            @Html.DisplayFor(modelItem => item.LastName)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.FirstMidName)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.EnrollmentDate)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.DateOfBirth)
        </td>  
        <td>
            @string.Join(",", item.Enrollments.Select(e => e.Course.Title))
        </td>
        <td>
            @item.Enrollments.Sum(e => e.Course.Credits)
        </td>
        <td>
            @Html.ActionLink("Edit", "Edit", new { id=item.ID }) |
            @Html.ActionLink("Details", "Details", new { id=item.ID }) |
            @Html.ActionLink("Delete", "Delete", new { id=item.ID })
        </td>
    </tr>
}
</table>
<br />

@Ajax.ActionLink("Top3", "Top3", new AjaxOptions() 
{ 
    HttpMethod = "GET",
    UpdateTargetId = "divStudents",
    InsertionMode = InsertionMode.Replace
})
<span style="color:Blue"></span>

<div id="divStudents">
</div>

    Page @(Model.PageCount < Model.PageNumber ? 0 : Model.PageNumber) of @Model.PageCount

    @Html.PagedListPager(Model, page => Url.Action("Index",
    new { page, sortOrder = ViewBag.CurrentSort, currentFilter = ViewBag.CurrentFilter }))

Vista parcial:

@model IEnumerable<ContosoUniversity.Models.Student>

<h3>Top 3 Student</h3>

<table style="border: 1px solid black; background-color:silver">

    @foreach (var item in Model)
    {
        <tr>
            <td>
                @Html.DisplayFor(modelItem => item.LastName)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.FirstMidName)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.EnrollmentDate)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.DateOfBirth)
            </td>
            <td>
                @string.Join(",", item.Enrollments.Select(e => e.Course.Title))
            </td>
            <td>
                @item.Enrollments.Sum(e => e.Course.Credits)
            </td>
        </tr>
    }

</table>

preguntado Oct 07 '14, 14:10

¿Cuál es su configuración de ruta? -

rutas.MapRoute( nombre: "Predeterminado", url: "{controlador}/{acción}/{id}", valores predeterminados: nuevo { controlador = "Inicio", acción = "Índice", id = UrlParameter.Optional } -

¿Debería ser diferente? -

0 Respuestas

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.