This is my first question on stackoverflow and hopefully it's not because of my poor searching skill.
I am recently trying to create a log server with .net core. I started a web api project and created something like this:
[HttpPost("/log")]
public IActionResult Post([FromQuery] string msg, [FromQuery] string stackTrace)
{
...
}
I stored each log as an object and I can use console.log to display its value. Then I am trying to use websocket to push the log into a web client.
I am hoping to modify this tutorial https://radu-matei.github.io/blog/aspnet-core-websockets-middleware/ to suit what I need.
The tutorial project works fine. Messages are sending and receiving between web clients.
However, I couldn't integrate the tutorial web app project with my web api controllers. The "/log" api gives a 404 respond.
So I decided to start a web app template and add a default web api values controller to it (which has the attribute [Route("api/[controller]")]).
The default web pages loaded fine but api/values gives a 404 respond.
What is the correct way to add a controller with route attributes to a web app?
Thanks a lot!