"free-quota limit" errro apears in tests

Hi,
I have placed the license registration before the apphost initializing and still I am getting the error in the image below.
Thanks


Thanks

I don’t see TestAppHost or NewInstance() in your StackTrace? I’m assuming the Exception is not occurring where you think it does.

Here is the entire stack.
The excetption is thrown on line 79:

Can you put together a small stand-alone repro without the License Key and publish it on GitHub so I can repro it locally, please.

This will not be reproducable since it is related to my entire solution. I dont even know how to simulate above the quota error in tests…

You just need more than 10 custom services, e.g:

public class MyRequest1 {}
public class MyRequest2 {}
//...
public class MyRequest11 {}

public class MyServices : Service
{
    public object Any(MyRequest1 request) => request:
    //... 
    public object Any(MyRequest11 request) => request:
}

I’m assuming there’s something weird in your environment/solution causing it, I just can’t tell from here.

This wont trigger the error in the new test project:

public class UnitTest1
    {
        [Fact]
        public void Test1()
        {
            TestAppHostInitializer test = new TestAppHostInitializer();
            test.Init().Start("http://localhost:2000");
        }
    }

    public class TestAppHostInitializer : AppSelfHostBase
    {
        public TestAppHostInitializer() : base("EYEZ", typeof(UnitTest1).Assembly) { }

        public override void Configure(Container container)
        {
            
        }
    }
    public class MyRequest1 : IReturnVoid
    {

    }
    public class MyServices : Service
    {
        public object Any (MyRequest1 request) => null;
        public object Any1(MyRequest1 request) => null;
        public object Any2(MyRequest1 request) => null;
        public object Any4(MyRequest1 request) => null;
        public object Any5(MyRequest1 request) => null;
        public object Any6(MyRequest1 request) => null;
        public object Any7(MyRequest1 request) => null;
        public object Any8(MyRequest1 request) => null;
        public object Any9(MyRequest1 request) => null;
        public object Any10(MyRequest1 request) => null;
        public object Any11(MyRequest1 request) => null;
    }

Because only one of them is considered a Service, you need 11 different empty Request DTOs, all using the Any (or other HTTP Method) for them to be treated as a Service, I’ve updated my example to include the method name.

https://github.com/avifatal/XUnitTestProject1 I cant reproduce the error

You’re still using AnyN, it needs to be exactly Any() for all Request DTOs (or any other HTTP Verb) for it to be recognized as a Service in ServiceStack.

Reproduced, lisence exists and getting quota error

This doesn’t repro the issue:

I suspect you have something interfering with verification in your environment, if you want to register the license key inline remove any license keys you may have in SERVICESTACK_LICENSE environment variable, otherwise you may have a dirty bin/ or obj/ folders, try removing the folders and rebuilding the solution.

Or maybe you have an internal Exception masquerading the error, can you try enabling Strict Mode to see if you get a different Exception:

Env.StrictMode = true;
Licensing.RegisterLicense(@"...");

Otherwise what Culture are you running in? and does changing to use InvariantCulture resolve the issue? e.g:

using System.Globalization;
//...

CultureInfo.CurrentCulture = CultureInfo.InvariantCulture;
Licensing.RegisterLicense(@"...");

this was in the way: SERVICESTACK_LICENSE, now its working. thanks.

I had problems activating with env variable so the support long time ago and the team suggested inline as well. I assume that it is not good advice for production use…

1 Like