'Blank page ASP.NET Core MVC

I want to run my project with Visual Studio, but I'm getting a blank page, actually I have no idea what to do. I didn't change any routes, it worked before, but now it's not working for some "magic" reason.

Layout:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>@ViewData["Title"] - ToDo</title>
    <link rel="stylesheet" href="~/css/site.css" asp-append-version="true" />
</head>
<body>
    <header>
        <nav>
            <div class="wrapper">
                  <a asp-controller="Home" asp-action="Index" class="brand">TODO</a>
                <div class="navigations">
                        <div class="left-nav">
                            <ul class="left-links">
                                <li><a asp-controller="Home" asp-action="Index">Home</a></li>
                                <li><a asp-controller="Home" asp-action="Contact">Contact</a></li>
                            </ul>
                        </div>
            
                    <div class="right-nav">
                        <ul class="right-links">
                            <li><a href="#">Login</a></li>
                            <li><a asp-controller="Account" asp-action="Register">Register</a></li>
                        </ul>
                    </div>
                </div>
            </div>
        </nav>
    </header>
    <div class="container">
        <main role="main" class="main-content">
            @RenderBody()
        </main>
    </div>

    <footer class="border-top footer text-muted">
        <div class="container">
            &copy; 2022 - ToDo - <a asp-area="" asp-controller="Home" asp-action="Privacy">Privacy</a>
        </div>
    </footer>
    <script src="~/lib/jquery/dist/jquery.min.js"></script>
    <script src="~/js/site.js" asp-append-version="true"></script>
    @await RenderSectionAsync("Scripts", required: false)
</body>
</html>

Program class in file Program.cs:

global using ToDo.Data;
global using Microsoft.EntityFrameworkCore;
global using Microsoft.AspNetCore.Identity;
global using ToDo.Models;
using Microsoft.AspNetCore.Builder;

var builder = WebApplication.CreateBuilder(args);

var connectionString = builder.Configuration.GetConnectionString("UserConnection");

// Add services to the container.
builder.Services.AddControllersWithViews();
builder.Services.AddDbContext<UserContext>(options => options.UseSqlServer(connectionString));
builder.Services.AddIdentity<User, IdentityRole>().AddEntityFrameworkStores<UserContext>();

var app = builder.Build();

// Configure the HTTP request pipeline.
if (!app.Environment.IsDevelopment())
{
    app.UseExceptionHandler("/Home/Error");
    app.UseHsts();
}

app.UseHttpsRedirection();
app.UseStaticFiles();

app.UseRouting();

app.UseAuthentication();
app.UseAuthorization();

app.MapControllerRoute(
    name: "default",
    pattern: "{controller=Home}/{actions=Index}/{id?}");

app.Run();

This is what I get when I run project from Visual Studio:

Empty page



Solution 1:[1]

Okay, I'm completely f*cked up. I had

app.MapControllerRoute( name: "default", pattern: "{controller=Home}/{actions=Index}");

Instead of

app.MapControllerRoute( name: "default", pattern: "{controller=Home}/{action=Index}");

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 W?adys?aw