ServiceStack service URL on client and server

I'm using ServiceStack, but don't know how to approach what should be a simple and general concept. Perhaps this should be posted as two separate questions.

  • How can I provide the server url to the client? This is not inherently a ServiceStack issue, but would like to know if there is anything out of the box that I missed. I think either through a config file for the client desktop application, or perhaps a web service discovery mechanism, if such a thing exists.

edit: I mean the base / root url of the server where the clients are desktop applications (deployed to home in some cases). Most ServiceStack examples use the hard-coded "localhost: 82". Therefore, a mechanism is needed to find the real URL.

  • To create a RESTful service, I would like to provide links (href) so that the client can navigate without knowing too much about the service. Is there an easy way to do this? Should I expand on my DTO answers and nudge those details? From separating POV concerns, this doesn't seem like the best way to do it.



source to share

1 answer

I think the built-in ServiceStack metadata page can help you on both accounts. It should be available to you automatically at http //: [service_root] / metadata. For example:

You can provide this url to the client and they should be able to interact with the service without issue. It provides detailed information on all service operations, the different ways to invoke them, and even an example request / responses in the supported content types.

You can provide descriptions of operations to further clarify by decorating your request DTOs with the [Description] attribute.

[Description("This is a service description for thinger.")]
public class Thinger




All Articles