Free tools Windows power users keep installed
One-click scans. No signup required.
An ASP.NET Core Empty Web project gives you the host, not a finished set of pages. To make it respond, map a route in Program.cs and run the app. If you want conventional pages instead, add Razor Pages—or start with the webapp template, which includes that structure.
Choose the right starting point
Use the Empty Web template when you want to learn how the ASP.NET Core host is assembled and add routes and services yourself. Use Razor Pages when you want a page-oriented website scaffold from the start. Microsoft documents the Empty Web template as dotnet new web and its Razor Pages template as dotnet new webapp.
| Starting point | What you get | Good fit |
|---|---|---|
Empty Web: dotnet new web |
A minimal host; you add the endpoints, services, and UI approach. | Learning the host or building a small app with deliberately chosen components. |
Razor Pages: dotnet new webapp |
Razor Pages support and a page-oriented project structure, including a Pages directory. |
A site made up of conventional pages that you want to build immediately. |
These are different starting amounts of structure, not different ways to run an ASP.NET Core application. If you already have an Empty Web project, continue below with a route or add Razor Pages yourself. See Microsoft’s WebApplication and WebApplicationBuilder documentation and Razor Pages architecture guide.
Make an Empty Web project return a response
The smallest useful result is a route that returns content when a browser requests it. In an Empty Web project’s Program.cs, the basic pattern is to create a WebApplication, map a route, and run the host:
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
#1 Best Overall
var builder = WebApplication.CreateBuilder(args);
var app = builder.Build();
app.MapGet("/", () => "Hello, world!");
app.Run();
Here, MapGet handles an HTTP GET request for the root path (/) and returns plain text. Start the project with dotnet run, then open the local URL printed in the terminal. The exact URL and whether the launch profile uses HTTP or HTTPS depend on your project configuration.
This is a responding endpoint, not yet a multi-page website. Add routes for other paths or select a UI approach—such as Razor Pages—when you need HTML pages, shared layouts, or page-specific server-side logic. The Microsoft WebApplication example documents the minimal host and endpoint pattern.
Rank #2
Add Razor Pages to the Empty Web project
Razor Pages lets a .cshtml file handle a request directly when the file begins with the @page directive. In an Empty Web project, register Razor Pages before building the app, then map its page endpoints:
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddRazorPages();
var app = builder.Build();
app.MapRazorPages();
app.Run();
Create Pages/Index.cshtml and begin it with @page. For example:
@page
<h1>My first page</h1>
<p>This is my ASP.NET Core website.</p>
The Index page is conventionally served at the site root. Keep the service registration and endpoint mapping: without them, the app has not been configured to serve Razor Pages. For the supported conventions and page behavior, consult Microsoft’s Razor Pages architecture and concepts.
Run, edit, and refresh
For a page-oriented starter, Microsoft’s CLI quickstart creates a project and starts the file watcher with these commands:
Rank #4
dotnet new webapp -o RazorPagesSample
cd RazorPagesSample
dotnet watch
- Run
dotnet watchfrom the project directory. - Open the local address reported by the running app.
- Edit
Pages/Index.cshtmland save the file. - Refresh the browser to see the change. The quickstart describes changes being reflected while the app is running.
For an existing Empty Web project, the same edit-and-refresh idea applies: change the mapped route in Program.cs, or add Razor Pages and edit Pages/Index.cshtml. Use dotnet watch to run with file watching, or stop and restart the app after code changes. Microsoft’s ASP.NET Core quickstart covers the create, run, and edit loop.
Keep only middleware your site needs
Middleware processes requests as they pass through the application. A Razor Pages sample may include HTTPS redirection, routing, authorization, static asset handling, page mapping, and production error handling. These are not a mandatory checklist for every Empty Web app: include components that match the app’s features and deployment.
- HTTPS redirection: sends HTTP requests to HTTPS when the app is configured to use HTTPS.
- Authorization: enforces access rules when the app uses them. Microsoft notes that authorization can be removed from its sample when it is not needed.
- Static assets: enables delivery of files such as CSS, JavaScript, and images when your app uses them.
- Production error handling and HSTS: the Razor Pages tutorial configures these outside Development for its sample.
Do not deploy with the Development environment enabled. Microsoft warns that the developer exception page can expose sensitive information. Follow the Razor Pages tutorial’s environment and pipeline guidance and configure production behavior for your deployment.
Check the current Razor Pages prerequisites
Microsoft’s current Razor Pages tutorial targets the .NET 10 SDK and lists Visual Studio with the ASP.NET and web development workload, or Visual Studio Code with C# Dev Kit, among its development options. Those prerequisites apply to that tutorial’s workflow; an existing project’s requirements depend on its target framework and development setup. The Microsoft tutorial is the reference for its current setup and project steps.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

