Routing requires // after host?

I have a net5.0 app with ServiceStack 5.14 running in Visual Studio Professional 2022.

Routes are getting defined like this in a Apphost.cs

public override RouteAttribute[] GetRouteAttributes(Type requestType)
var routes = base.GetRouteAttributes(requestType);
routes.Each(x => x.Path = “/api” + x.Path);
return routes;

Giving us a ServiceStack RouteAttribute.paths like “/api/things” … all good, as expected.

But if I run it in VS and request http://localhost:64200/api/things I get an Http 405 and a “NotImplementedException”

And if I request http://localhost:64200//api/things (Note the ‘//’ after the port) it works HTTP 200. Sadly not expected and breaks my client. 8¬(

Any ideas what maybe causing this? I’m inheriting this code and I am unfamiliar with ServiceStack. The services route as expected in production but not in dev. Makes me wonder if it is a Visual Studio feature, but it does not happen for other netcore apps without ServiceStack …

Hi @butt0nm4n,

Do you have a fallback route registered? Eg, are you using a plugin like SpaFeature with EnableSpaFallback = true? It sounds like routes are being missed and then picked up by a fallbackroute. If you provide a minimal reproduction of the issue, I can check it out.

Since you’re using the /api route yourself, you need to disable the built in /api route:

ConfigurePlugin<PredefinedRoutesFeature>(feature => feature.JsonApiRoute = null);

Thank you. That worked nicely.

1 Like