Tengo un controlador en mi Web Api llamado ConfigController y dentro un método llamado Index
Si escribo en el navegador http://localhost:5001/api/Config/Index me funciona perfecto,
Pero yo necesito llamarlo de la siguiente forma: http://localhost:5001/Index
¿Cómo puedo hacer esto?
Mi código:
public class ConfigController : ApiController
{
private readonly IAppAggregateServices appAggregateServices;
public ConfigController(IAppAggregateServices appAggregateServices)
{
this.appAggregateServices = appAggregateServices;
}
[HttpGet]
public HttpResponseMessage Index()
{
string responseString = @"HOLA MUNDO ";
var response = new HttpResponseMessage();
response.Content = new StringContent(responseString);
response.Content.Headers.ContentType = new MediaTypeHeaderValue("text/html");
return response;
}
}