Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
ServiceRoute Class

ServiceRoute Class

.NET Framework 4.6 and 4.5

Enables the creation of service routes over HTTP for WCF Services with support for extension-less base addresses.


Namespace:  System.ServiceModel.Activation
Assembly:  System.ServiceModel.Activation (in System.ServiceModel.Activation.dll)

public class ServiceRoute : Route

The ServiceRoute type exposes the following members.

Public methodServiceRouteInitializes a new instance of the ServiceRoute class with the specified route prefix, service host factory, and service type.

Public propertyConstraintsGets or sets a dictionary of expressions that specify valid values for a URL parameter. (Inherited from Route.)
Public propertyDataTokensGets or sets custom values that are passed to the route handler, but which are not used to determine whether the route matches a URL pattern. (Inherited from Route.)
Public propertyDefaultsGets or sets the values to use if the URL does not contain all the parameters. (Inherited from Route.)
Public propertyRouteExistingFilesGets or sets a value that indicates whether ASP.NET routing should handle URLs that match an existing file. (Inherited from RouteBase.)
Public propertyRouteHandlerGets or sets the object that processes requests for the route. (Inherited from Route.)
Public propertyUrlGets or sets the URL pattern for the route. (Inherited from Route.)

Public methodEquals(Object)Determines whether the specified object is equal to the current object. (Inherited from Object.)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public methodGetHashCodeServes as the default hash function. (Inherited from Object.)
Public methodGetRouteDataReturns information about the requested route. (Inherited from Route.)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Public methodGetVirtualPathReturns information about the URL that is associated with the route. (Inherited from Route.)
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Protected methodProcessConstraintDetermines whether a parameter value matches the constraint for that parameter. (Inherited from Route.)
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)

ServiceRoute is derived from Route. When the ServiceRoute constructor is called, WCF will add the corresponding route prefix (url pattern) and a (hidden) route handler to the ASP.NET RouteCollection, and cache the corresponding route prefix, service host factory and service type info into an internal hash table for future service activation.Note: if developers directly manipulate the route collection on a ServiceRoute which has been added to the collection, the change may not be granted by WCF. For more information about changing elements in a route collection, see RouteCollection. It is recommended that developers define all ServiceRoute in the global.asax file and do not remove a ServiceRoute from the RouteCollection dynamically.

.NET Framework

Supported in: 4.6, 4.5, 4

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
© 2015 Microsoft