My route is: [HttpGet] [Route("General/GetStreetsOfCityByText/{cityCode}/{txt}")] public IResult GetStreetsOfCityByText(int cityCode, string txt) {….} the string txt can be null. For enabling nullable parameter, I used MapHttpRoute: config.MapHttpAttributeRoutes();
config.Routes.MapHttpRoute( name: "optionalText", routeTemplate: "General/GetStreetsOfCityByText/{cityCode}/{txt}", defaults: new { txt = RouteParameter.Optional }); I try to invoke: http://localhost:56721/General/GetStreetsOfCityByText/3000/ But still gets 404 page not found I don't get what am I doing wrong