I have an Owin Startup class that registers a WebApi controller action and hooks it in using IAppBuilder.UseWebApi. My route templates is /api/packages/{id}/{version}
where version
may contain periods (as in 1.0.0
).
This works fine with self hosting, but when I try to run my code in IIS using Microsoft.Owin.Host.SystemWeb, something is preventing my action from being invoked when the path looks like a static content request.
For example, GET /api/packages/Foo/1.0
works on self host but results in a 404 on IIS.
If I add a trailing slash as in GET /api/packages/Foo/1.0/
it works in both self host and IIS.
It seems that something in the UseWebApi method is preventing Web Api from handling requests that look like files with extensions.
Other Owin middleware sees all of these requests, so I know the request is getting into the Owin pipeline, but then something about the UseWebApi
method seems to be ignoring some requests.
Related: Owin Middleware results in 404 on server, Owin hosted on IIS doesn't capture URLs with Dot "."