Skip to content

Missing middleware in the tutorial generated code #34317

@dotocan1

Description

@dotocan1

Description

Hello, the problem I found is that you have to manually add the:

app.AddControllers();
app.MapControllers();

middleware in the Program.cs file.
It does not get generated automatically when using the console command:
dotnet new webapi -o BookStoreApi

Without it, the routes don't get called.

Page URL

https://learn.microsoft.com/en-us/aspnet/core/tutorials/first-mongo-app?view=aspnetcore-8.0&tabs=visual-studio-code#test-the-web-api

Content source URL

https://github.com/dotnet/AspNetCore.Docs/blob/main/aspnetcore/tutorials/first-mongo-app.md

Document ID

83a5cb3b-23bc-4f0c-cd1c-1d1ffeb1131a

Article author

@wadepickett

Related Issues


Associated WorkItem - 365052

Metadata

Metadata

Assignees

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions