How to add controller (not view) support to a server-side Blazor project
问题 While my server-side Blazor app is running, I want some Javascript code in _Host.cshtml to be able to post data to a controller action. Of course, this happens completely outside of the scope of, and is unrelated to, the Blazor app itself. I thought this would be a matter of adding calls to services.AddControllers() and endpoints.MapControllers() at the appropriate places in Startup.cs . However, after doing this, and implementing the controller action, I made the following observations: