Upgraded to 5.10.0: ServiceStack.GetApiKeys/RegnerateApiKeys already assigned to another service

Hi @mythz

Just upgrading to ServiceStack 5.10.0, and started getting the following startup errors:

[{"errorCode":"AmbiguousMatchException","message":"Could not register Request 'ServiceStack.GetApiKeys' with s
    ervice 'ServiceStack.Auth.GetApiKeysService' as it has already been assigned to another service.\nEach Request DTO can only be handled by 1 service.","errors":[]},{"errorCode":"AmbiguousMatchException","message":"Could not re
    gister Request 'ServiceStack.RegenerateApiKeys' with service 'ServiceStack.Auth.RegenerateApiKeysService' as it has already been assigned to another service.\nEach Request DTO can only be handled by 1 service.","errors":[]}]

While I get these errors in the startup, the GetApiKeys and RegenerateApiKeys route seems to work as expected.

Any ideas?

This is due to the Service being registered twice, like you’re registering the AuthFeature plugin twice or trying to register the Services in ServiceStack.dll.

Can you confirm you’re not registering the AuthFeature plugin (or the ApiKeyAuthProvider) twice or your AppHost constructor isn’t trying to register a Service in ServiceStack.dll. Otherwise can you post the ex.ToString() of the Startup exception.

Can you try upgrading to v5.10.2 on NuGet which should resolve duplicated API Key Service registrations if your App was trying to register all Services in ServiceStack.dll.

1 Like

Hi @mythz,

I just got around to debugging this issue (before seeing the 5.10.2 update) and traced it back to my partner creating an ExperimentalAuthProvider that was inheriting your ApiKeyAuthProvider.

Once I removed this from the stack, all was happy again :slight_smile:

1 Like