I have done some looking around and not stumbled onto anything resembling the issue I am experiencing so I thought I would throw it up here and see what, if anything sticks.
I have a controller and method set up.
public class BoothAPIController : ITApiControllerBase
{
[HttpGet]
public HttpResponseMessage GetActiveAssetNumbersLike([FromUri] String id)
{
HttpResponseMessage ret;
// ... do some processing
return ret;
}
}
The routes are set up in Global.asax
protected void Application_Start(object sender, EventArgs e)
{
GlobalConfiguration.Configuration.Routes.MapHttpRoute(
name: "CustomApi",
routeTemplate: "api/{controller}/{action}/{id}",
defaults: new { id = RouteParameter.Optional });
GlobalConfiguration.Configuration.Routes.MapHttpRoute(
name: "BoothWithDateAPI",
routeTemplate: "api/{controller}/{boothID}/{year}/{month}/{day}");
GlobalConfiguration.Configuration.Routes.MapHttpRoute(
name: "DefaultApi",
routeTemplate: "api/{controller}/{id}",
defaults: new { id = RouteParameter.Optional });
}
And these two requests execute flawlessly ...
http://localhost:52211/api/BoothAPI/GetActiveAssetNumbersLike/PR
http://localhost:52211/api/BoothAPI/GetActiveAssetNumbersLike/PRN0
This one however ... returns a 404 error ...
http://localhost:52211/api/BoothAPI/GetActiveAssetNumbersLike/PRN
The Header for the failed request looks like ...
Cache-Control →private
Content-Length →2879
Content-Type →text/html; charset=utf-8
Date →Mon, 29 Aug 2016 12:53:08 GMT
Server →Microsoft-IIS/8.0
X-AspNet-Version →4.0.30319
X-Powered-By →ASP.NET
X-SourceFiles →= [string]
While the successful requests look like
Cache-Control →no-cache
Content-Length →7731
Content-Type →application/json; charset=utf-8
Date →Mon, 29 Aug 2016 13:13:43 GMT
Expires →-1
Pragma →no-cache
Server →Microsoft-IIS/8.0
X-AspNet-Version →4.0.30319
X-Powered-By →ASP.NET
X-SourceFiles → [string]
(Shrugs) I dunno ... I am at a complete loss why the one change in the parameter makes a difference.