Get the list of all active SS services in a service

Hello, I would like to know if there’s a way to get a list of all ServiceStack currently active services (not only my services but also Register/Auth/AssignRoles and so on…) and their related Verbs (ala Metadata page).
I’d need them returned as the Result of a Service, could it be done?

There’s no built-in Service that does this, so you would need to create your own which you can do by inspecting the cache where user sessions are stored:

Note: the User Session info is very sensitive information, i.e. you never want to make the sessionId’s available publicly, so you’ll either want to protect it behind an Authenticated Service or copy it to a custom DTO that doesn’t expose any sensitive information.

mmm User Session?
I don’t know if I’ve explained my question well, but I would like access something that return me the list of all my WebSerice endpoints, more or less like the Metadata page does… if there’s no service I will do my own, I just need to know what is the way to get them.
Thank you and sorry if I wasn’t clear!

ok sorry thought you asked about Active Sessions.

There’s the /types/metadata Types Metadata Service, e.g:

Yeah! it’s exactly what I need!
it would be great access this data without resolve the /types/metadata.json request… I noticed that if I have disabled the metadata page I can’t acces the types… is there any/data structure/class to get them, from my service?

See this earlier answer: Finding types for DTO Generation

Thank you very much! I was able to create my service based on metadata types!
I’ve just one more question… I noticed that if I disable the Metadata feature:

var disableFeatures = Feature.Html | Feature.Metadata;
hostConfig.EnableFeatures = Feature.All.Remove(disableFeatures);

my service can’t work… I would like to know if there’s a way to at least close the Metadata page to a specific Role; I’ve tried:

typeof(NativeTypesService).AddAttributes(new RequiredRoleAttribute("Admin"));

but I still see the page even if I’m not authenticated…

There’s no “intermediate state” for Plugins, they’re either registered or they’re not, in which case they functionally don’t exist in your ServiceStack Instance.

You’re also confusing the Metadata Page feature which is in the MetadataFeature plugin with the NativeTypesFeature plugin which provides the functionality and metadata services required for Add ServiceStack Reference.

The Config.EnableFeatures = Feature.All.Remove(Feature.Metadata) is a quick way to disable all metadata features which disables both MetadataFeature and NativeTypesFeature.

So instead of removing all metadata plugins with Config.EnableFeatures = Feature.All.Remove(Feature.Metadata), you can just remove the metadata page with:

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

Which will leave the NativeTypesFeature pre-registered which is what provides the /types/metadata service.

1 Like

Thank you very much!
It was exactly what I needed!