Skip to content
grhm edited this page May 15, 2012 · 9 revisions

ServiceStack will automatically generate a metadata page about the webservice. The metadata can be found under the URL /metadata:

Example

The Metadata page contains:

  • A list of all your webservices and the endpoints they are available on.
  • A list of coding examples showing you how to call each endpoing a number of different ways.
  • Links to all the XSD types used by your web services
  • Links to the web services SOAP 1.1 / 1.2 WSDLs

So the main purpose for the metadata page is to provide a small documentation about your service, so other persons can use your service more easily.


There's also the possibility to create a custom description for a service. To do that, you have to mark your request DTO with the attribute System.ComponentModel.DescriptionAttribute, e. g:

[Description("A service which provides basic get and delete operations for users")]
[RestService("/users")]
public class User
{
    public string Name { get; set; }
    public string Company { get; set; }
    public int Age { get; set; }
    public int Count { get; set; }
}

If now the detail page of the specific service is inspected, the description configured above will be displayed.

How to disable the metadata page?

The metadata page is a feature and can be removed by setting:

SetConfig(new EndpointHostConfig { 
    EnableFeatures = Feature.All.Remove(Feature.Metadata)
});

This can be done by configuration (AppSetting) by adding the following method. Note that the Feature enum is decorated with the Flags attribute. By comma separating multiple feature names in the value of the DisableFeature appsetting you will be able to remove multiple features when desired.

SetConfig(new EndpointHostConfig { 
     EnableFeatures = Feature.All.Remove(GetDisabledFeatures())
});
private static Feature GetDisabledFeatures()
{
    var disabled = ConfigurationManager.AppSettings.Get("DisabledFeatures");

    Feature d;
    if (!string.IsNullOrWhiteSpace(disabled)
	&& Enum.TryParse(disabled,true, out d))
    {
	 return d;
    }
    return Feature.None;
}

And an example app setting disabling the metadata page and all soap endpoints. <AppSettings> <add key="DisabledFeatures" value="MetaData, Soap, Soap11, Soap12" /> </appSettings>

Next wikipage: Rest, SOAP & default endpoints

Clone this wiki locally