So, I am new in asp.net core, and I am trying to create a new web api in asp.net core. The default controller is Weatherforecast, in other words when I debug the application in the browser the main page is always Weatherforecast. I added a new controller named MainController.cs, and I wrote some simple code there:
[Route("[controller]")]
[ApiController]
public class MainController : ControllerBase
{
[HttpGet]
public string getmain()
{
return "welcome";
}
}
} in a word, i want my application's main controller to be https://localhost:43372/main and not https://localhost:43372/weatherforecast, also I tried to delete Weatherforecast controller and Weatherforecast.cs file, however when I deleted it, the main page was still https://localhost:43372/weatherforecast, but with error because I deleted the files. So, how can i make my new controller default for me web app?