LinqPad unable to pick up ApiController?
Hi, may I know why the code below unable to access via http://localhost:5000/api/my. But if I run the same code in VS, it is ok.
var builder = WebApplication.CreateBuilder();
// Add services to the container.
builder.Services.AddControllers();
var app = builder.Build();
// Configure the HTTP request pipeline.
//app.UseHttpsRedirection();
app.UseAuthorization();
app.MapControllers();
app.Run();
[ApiController]
[Route("api/[controller]")]
public class MyController : ControllerBase
{
[HttpGet]
public ActionResult<string> Get()
{
return "Hello World";
}
}
Please help and advise. Thank you.
Comments
-
Hi, Sorry, just found someone already answered it. Thanks.
https://forum.linqpad.net/discussion/2789/net-6-0-controllerbase-not-working-with-minimal-api