0

I add a route named default with the pattern

{controller=Assets}/{action=Index}/{id?}

but I get an http 404 "Not Found" error.

If I type in /Assets in the browser, it finds the view, it's just on the first request.

This issue occurred after installing VS 2026 and the latest SDKs.

Any ideas?

Configuring WebApplicationBuilder:

_ = builder.Services.AddControllersWithViews(mvcOptions);

Adding the route named default:

app.MapControllerRoute(ruteName, pattern);

Edit: fixed it by adding Assets as start url in launch profiles.

1

1 Answer 1

2

The documentation states that the route named 'default' will be loaded on a root request, but I'm unable to get it to work.

However, you can add the controller name to the URL option in Launch Profiles in Visual Studio.

Debug > Project name Debug Properties

It works, but I would prefer setting the startup route in code.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.