This is the following, I have a web service done in Visual Studio that has some methods. The problem is that I'm not able to access one of this methods through its full URL, just locally. Here is the method code so that you can check:
[Route("api/BuscaDestino/{id1}/{id2}")]
public class BuscaDestinoController : ApiController
{
//HttpResponseMessage / IHttpActionResult
public IHttpActionResult GetBuscaDestino(string id1, string id2)
{
try
{
var destinoDao = new DestinoDAO();
IList<BuscaDestino> destinos = destinoDao.ListaCidadesDestino(id1, id2);
//return Request.CreateResponse(HttpStatusCode.OK, destinos);
return Ok(destinos);
}
catch
{
var mensagem = "Não foram encontrados destinos com os valores digitados.";
//return Request.CreateResponse(HttpStatusCode.OK, mensagem);
return Ok(mensagem);
}
}
}
When I'm with Visual Studio open and select the debug option, I can access this method as follows:
Localhost: 1177 / api / HomeSearch / Parametro1 / Parametro2
When typing this it returns me the result normally, the problem is when I try to use this same method with the complete URL, eg:
www.meusite.com/meuwebservice/api/Discussion/Parametro1/Parametro2
It just does not return anything, but if I put other methods in place it returns no problem at all. I have already tried to verify the database connection and it is working normally. If anyone can help from now thank you.