M
M
maxemga2021-06-19 13:25:27
ASP.NET
maxemga, 2021-06-19 13:25:27

Why is ASP.NET request not working?

I'm trying to make a banal GET request to get a response:
namespace SiteAPI.Controllers

{
    [ApiController]
    [Route("[controller]")]
    public class HomeController : ControllerBase
    {
        private readonly ILogger<HomeController> _logger;

        public HomeController(ILogger<HomeController> logger)
        {
            _logger = logger;
        }

        [HttpGet]
        public IActionResult Get()
        {
            return Ok("hello");
        }
    }
}

launchSettings.json
"SiteAPI": {
      "commandName": "Project",
      "dotnetRunMessages": "true",
      "launchBrowser": true,
      "launchUrl": "app",
      "applicationUrl": "https://localhost:5001;http://localhost:5000",
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      }
    }

I also screwed React (mb because of this somehow it doesn’t work):
app.UseSpa(spa =>
            {
                spa.Options.SourcePath = "client";

                if (env.IsDevelopment())
                {
                    spa.UseReactDevelopmentServer(npmScript: "start");
                }
            });

But when you request https://localhost:5000/app/Home nothing comes up
What am I doing wrong?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vasily Bannikov, 2021-06-19
@maxemga

make a request https://localhost:5000/Home

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question