Limit in route Services per class?

We have a IPlugin that registers a StaticPageService (for razor pages) that contains more than 11 request DTO’s and routes. It seems that anything over 11 the routes/services do not get picked up by ServiceStack. It also seems to go in alphabetical order.

When we go to metadata url /operations/metadata to see the routes we only see the first 11 routes (alphabetically).

Is there a limitation or something else that may prevent more than 11 routes?

We currently have 13 cshtml razor pages and only the first 11 (alphabetically) show a webpage. The pages after 11 bring back a 404 Not Found.

Note: .NET Core v2.1.1 - ServiceStack v5.4.0

// AppHost (partial code)
public override void ConfigureServices()
        {
            LoadPlugin(new MyStaticPageFeature());
        }

// Feature Class
public class MyStaticPageFeature : IPlugin
    {
        public void Register(IAppHost appHost)
        {
            appHost.RegisterService<StaticPageService>();
            appHost.RegisterService<HelloService>();
        }
    }
namespace MyApp.Core.Services.MainApp
{
    public class StaticPageService : Service
    {
        public object Any(Page1 request) => request;
        public object Any(Page2 request) => request;
        public object Any(Page3 request) => request;
        public object Any(Page4 request) => request;
        public object Any(Page5 request) => request;
        public object Any(Page6 request) => request;
        public object Any(Page7 request) => request;
        public object Any(Page8 request) => request;
        public object Any(Page9 request) => request;
        public object Any(Page10 request) => request;
        public object Any(Page11 request) => request;
        public object Any(Page12 request) => request;
        public object Any(Page13 request) => request;
    }
}

namespace MyApp.Core.ServiceModels.MainApp
{

    [Route("/page1/")]
    public class Page1 : IReturnVoid { }

    [Route("/page2/")]
    public class Page2 : IReturnVoid { }

    [Route("/page3/")]
    public class Page3 : IReturnVoid { }

    [Route("/page4/")]
    public class Page4 : IReturnVoid { }

    [Route("/page5/")]
    public class Page5 : IReturnVoid { }

    [Route("/page6/")]
    public class Page6 : IReturnVoid { }

    [Route("/page7/")]
    public class Page7 : IReturnVoid { }

    [Route("/page8/")]
    public class Page8 : IReturnVoid { }

    [Route("/page9/")]
    public class Page9 : IReturnVoid { }

    [Route("/page10/")]
    public class Page10 : IReturnVoid { }

    [Route("/page11/")]
    public class Page11 : IReturnVoid { }

    [Route("/page12/")]
    public class Page12 : IReturnVoid { }

    [Route("/page13/")]
    public class Page13 : IReturnVoid { }

}

Can you provide a repro on GitHub that shows the issue? I’m not able to repro it, all paths are displayed in the /metadata page:

And none of the routes return a 404.

Note: Routes shouldn’t have trailing slashes, e.g. they should just be “/page1”, “/page2”.

The end / was due to modifying from actual urls. Thanks for the note though!

I’ll see what I can put together. Here is a screenshot of what operations/metadata show.

Also, it doesn’t seem to matter which Service is registered it is always only showing 11 routes.

Also, if multiple Service’s are registered the first one shows only eleven and the the next ones only show the first route (alphabetically).

I’m not sure where all the Types from NativeTypesService are coming from.

These are services used in Add ServiceStack Reference feature for generating DTOs in different languages, if you don’t need to generate DTOs for clients from a URL you can remove Add ServiceStack Reference with:

Plugins.RemoveAll(x => x is NativeTypesFeature);

@mythz it looks like it’s an issue/bug with Licensing.

When I cloned the RazorSS project and added in the above Page1 - Page13 services/routes I received the the following error.

ServiceStack.LicenseException: 'The free-quota limit on '10 ServiceStack Operations' has been reached. Please see https://servicestack.net to upgrade to a commercial license or visit https://github.com/ServiceStackV3/ServiceStackV3 to revert back to the free ServiceStack v3.'

Then I realized I didn’t put in the license for this prototype project. Once I put in the license (temporarily with ServiceStack.Licensing.RegisterLicense()) all routes are returned.

Weirdly the same license error does not show on that prototype project.

As a side note, the SS Account Subscription page should probably include the preferred method for registering a license with .NET Core. I’m assuming appsettings.json?

My preferred method by far is c) with the SERVICESTACK_LICENSE Environment variable as it only needs to be set globally once on your dev and deployment servers which will apply to all projects running on each server and updating the license key only needs to updated in one place to apply to all projects on each pc.

If I was going to register it per project I’d prefer to instead register it in code so it’s embedded in the binary (not susceptible to accidental config changes) as it’s required and there should be no reason to change the License Key to a different key that it was developed and tested with. With Option b)

Licensing.RegisterLicense(licenseKeyText);

.NET Core projects can still register the servicestack:license key in the projects Web.Config, i.e:

<appSettings>
    <add key="servicestack:license" value="{licenseKeyText}" />
</appSettings>

Web.config can still be in .NET Core Apps where it’s used to configure IIS settings.

For .NET Core Apps it does attempt to register “servicestack:license” key in your configured configuration source which can be any number of cascading sources or no sources since it’s only an optional high-level library option in .NET Core. The problem with .NET Core since the configuration API is only a library is that it’s only available when the .NET Core host loads it so you could have an issue if you exceed the free-quotas before your AppHost is initialized (e.g. creating OrmLite tables outside of your AppHost).

I’ve added a note under option A) that you can register it in your .NET Configuration source, but it’s not my recommended option for reasons above.

Note: If you want to use a different config key you can read it as a string from config as expected:

Licensing.RegisterLicense(Configuration["license"]);