C
C#7mo ago
Arno

Creating a new Razor Pages project in .net 6

Whenever I create a new Razor Pages project in .net 6 I get the notification in the screenshot. I have no idea what I am doing wrong or which files I have to send.
No description
21 Replies
Mayor McCheese
Mayor McCheese7mo ago
Can you show your project layout in the solution explorer? You're getting a 404, which means the server is listening; but it can't find an index page to show the data at the root level of your site.
Pobiega
Pobiega7mo ago
Also the .net console output from when you run your app
Arno
Arno7mo ago
No description
Arno
Arno7mo ago
No description
Mayor McCheese
Mayor McCheese7mo ago
expand pages
Arno
Arno7mo ago
No description
Arno
Arno7mo ago
No description
Mayor McCheese
Mayor McCheese7mo ago
Can you show $code for Index.cshtml
MODiX
MODiX7mo ago
To post C# code type the following: ```cs // code here ``` Get an example by typing $codegif in chat For longer snippets, use: https://paste.mod.gg/
Arno
Arno7mo ago
@page
@model RazorPagesMovie.Pages.Movies.IndexModel

@{
ViewData["Title"] = "Index";
}

<h1>Index</h1>

<p>
<a asp-page="Create">Create New</a>
</p>
<table class="table">
<thead>
<tr>
<th>
@Html.DisplayNameFor(model => model.Movie[0].Title)
</th>
<th>
@Html.DisplayNameFor(model => model.Movie[0].ReleaseDate)
</th>
<th>
@Html.DisplayNameFor(model => model.Movie[0].Genre)
</th>
<th>
@Html.DisplayNameFor(model => model.Movie[0].Price)
</th>
<th></th>
</tr>
</thead>
<tbody>
@foreach (var item in Model.Movie) {
<tr>
<td>
@Html.DisplayFor(modelItem => item.Title)
</td>
<td>
@Html.DisplayFor(modelItem => item.ReleaseDate)
</td>
<td>
@Html.DisplayFor(modelItem => item.Genre)
</td>
<td>
@Html.DisplayFor(modelItem => item.Price)
</td>
<td>
<a asp-page="./Edit" asp-route-id="@item.ID">Edit</a> |
<a asp-page="./Details" asp-route-id="@item.ID">Details</a> |
<a asp-page="./Delete" asp-route-id="@item.ID">Delete</a>
</td>
</tr>
}
</tbody>
</table>
@page
@model RazorPagesMovie.Pages.Movies.IndexModel

@{
ViewData["Title"] = "Index";
}

<h1>Index</h1>

<p>
<a asp-page="Create">Create New</a>
</p>
<table class="table">
<thead>
<tr>
<th>
@Html.DisplayNameFor(model => model.Movie[0].Title)
</th>
<th>
@Html.DisplayNameFor(model => model.Movie[0].ReleaseDate)
</th>
<th>
@Html.DisplayNameFor(model => model.Movie[0].Genre)
</th>
<th>
@Html.DisplayNameFor(model => model.Movie[0].Price)
</th>
<th></th>
</tr>
</thead>
<tbody>
@foreach (var item in Model.Movie) {
<tr>
<td>
@Html.DisplayFor(modelItem => item.Title)
</td>
<td>
@Html.DisplayFor(modelItem => item.ReleaseDate)
</td>
<td>
@Html.DisplayFor(modelItem => item.Genre)
</td>
<td>
@Html.DisplayFor(modelItem => item.Price)
</td>
<td>
<a asp-page="./Edit" asp-route-id="@item.ID">Edit</a> |
<a asp-page="./Details" asp-route-id="@item.ID">Details</a> |
<a asp-page="./Delete" asp-route-id="@item.ID">Delete</a>
</td>
</tr>
}
</tbody>
</table>
Arno
Arno7mo ago
Tutorial: Get started with Razor Pages in ASP.NET Core
This is the first tutorial of a series that teaches the basics of building an ASP.NET Core Razor Pages web app.
Arno
Arno7mo ago
I couldn't even run it on "Run the app"
Mayor McCheese
Mayor McCheese7mo ago
Is that the one under movies or at the root?
Arno
Arno7mo ago
under movies
Mayor McCheese
Mayor McCheese7mo ago
I think that should be /movies then
Arno
Arno7mo ago
this is the other one
@page
@model IndexModel
@{
ViewData["Title"] = "Home page";
}

<div class="text-center">
<h1 class="display-4">Welcome</h1>
<p>Learn about <a href="https://docs.microsoft.com/aspnet/core">building Web apps with ASP.NET Core</a>.</p>
</div>
@page
@model IndexModel
@{
ViewData["Title"] = "Home page";
}

<div class="text-center">
<h1 class="display-4">Welcome</h1>
<p>Learn about <a href="https://docs.microsoft.com/aspnet/core">building Web apps with ASP.NET Core</a>.</p>
</div>
Mayor McCheese
Mayor McCheese7mo ago
in your browser
Arno
Arno7mo ago
it gives the same result
Arno
Arno7mo ago
No description
Mayor McCheese
Mayor McCheese7mo ago
hmmmm let me try and create a new one It's going to take me a few more hours before I can try to repro I created a new razor pages, and I"m not able to replicate your issues. Is this in a public repo somewhere?
Arno
Arno7mo ago
There is not one project that wants to run I have no idea why I follow the class example build error I updated my Visual Code and now it works for whatever reason Great, only wasted 1,5 days on it