I've developed a very simple API application in ASP.NET Core with just three routes:
`app.MapGet("/", (AppDbContext db) =>
{
return $"Hello World";
});
app.MapGet("/api/tasks", (AppDbContext db) =>
{
return db.Tasks;
});
app.MapPost("/api/tasks", (TaskViewModel model, AppDbContext db) =>
{
Task task = model.MapTo();
db.Add(task);
db.SaveChanges();
return $"New task {task} created\n" + task;
});`
While running the application locally on my computer, everything works correctly. However, when I deploy the application to Azure as an App Service, only the route with "Hello World" works, and the others that access my database return a 500 Internal Server Error.
Here's what I've already checked:
- The connection string to my database is correct.
- I've enabled application logs on Azure, but they didn't provide any relevant information.
This is my first experience with Dotnet and Azure, so I'm quite inexperienced with these tools.
I appreciate any assistance in advance!