?
添加后
代码:
using Microsoft.AspNetCore.Mvc;
namespace WebApplication1.Controllers
{
public class TestController : Controller
{
public IActionResult Index()
{
return View();
}
private readonly ILogger<TestController> _logger;
public TestController(ILogger<TestController> logger)
{
_logger = logger;
}
[Route("api/test")]
[HttpGet]
public IActionResult GetAdds(InputModel input)
{
_logger.LogInformation("日志信息,在输出页可看");
int sum = input.Number1 + input.Number2;
return Ok(new { Result = sum });
}
}
}
?同时可以查看输出日志:【备注】测试方式:可用postman调试
【备注】测试方式:可用postman调试?