0

I'm new to ASP.net and Web API, so right now I have a functioning webservice and I'm trying to register a new GET route, here is my code that's based on other codes already there

[ActionName("GetReserveAvailableHours")]
        [HttpGet]
        public IEnumerable<sp_getReserveAvailableHoursResult> GetReserveAvailableHours(int AAbranch_gkey, int AAarea_gkey, DateTime AAfecha, int AAcantidad, Char AAtipo_reserva)
        {
            IEnumerable<sp_getReserveAvailableHoursResult> result;
            try
            {
                DtContex = new DTPPublicDataContext();
                /*XElement wresulFactList = new XElement("Root",
                    int. ? null : new XAttribute("branch_gkey", AAbranch_gkey),
                    String.IsNullOrEmpty(zcitygkey) ? null : new XAttribute("city_gkey", zcitygkey)
             );*/

                result = DtContex.sp_getReserveAvailableHours(AAbranch_gkey, AAarea_gkey, AAfecha, AAcantidad, AAtipo_reserva);

            }
            catch (Exception ex)
            {
                throw ex;
            }

            return result;
        }

On routes

config.Routes.MapHttpRoute(
 name: "GetReserveAvailableHours",
 routeTemplate: "api/apservice/GetReserveAvailableHours/{AAbranch_gkey}/{AAarea_gkey}/{AAfecha}/{AAcantidad}/{AAtipo}",
 defaults: new
 {
    wplace_gkey = RouteParameter.Optional


}
 );

On other questions they indicate that some code fragments are missing, but right now I don't find anything missing in comparison with other GET functions, I indicate HttpGet first. Could anyone point me out the error?

David Ortega
  • 915
  • 9
  • 25
  • 1
    Possible duplicate of [The requested resource does not support HTTP method 'GET'](http://stackoverflow.com/questions/12765636/the-requested-resource-does-not-support-http-method-get) – stuartd Jul 11 '16 at 21:43
  • @stuartd already checked that question, but it doesn't seem to apply since I'm already using the HttpGet header – David Ortega Jul 11 '16 at 21:49
  • 2
    So you are definitely using `System.Web.Http.HttpGet` header and not `System.Web.Mvc.HttpGet`? – stuartd Jul 11 '16 at 21:52
  • @stuartd This webservice uses System.Web.Http, the HttpGet method doesn't seem available – David Ortega Jul 11 '16 at 22:00

0 Answers0