0 out of 1 rated this helpful - Rate this topic

ServiceRoute Class

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

System.Object
  System.Web.Routing.RouteBase
    System.Web.Routing.Route
      System.ServiceModel.Activation.ServiceRoute

Namespace:  System.ServiceModel.Activation
Assembly:  System.ServiceModel.Activation (in System.ServiceModel.Activation.dll)
public class ServiceRoute : Route

The ServiceRoute type exposes the following members.

  Name Description
Public method ServiceRoute Initializes a new instance of the ServiceRoute class with the specified route prefix, service host factory, and service type.
Top
  Name Description
Public property Constraints Gets or sets a dictionary of expressions that specify valid values for a URL parameter. (Inherited from Route.)
Public property DataTokens Gets 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 property Defaults Gets or sets the values to use if the URL does not contain all the parameters. (Inherited from Route.)
Public property RouteHandler Gets or sets the object that processes requests for the route. (Inherited from Route.)
Public property Url Gets or sets the URL pattern for the route. (Inherited from Route.)
Top
  Name Description
Public method Equals(Object) Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Protected method Finalize Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public method GetHashCode Serves as a hash function for a particular type. (Inherited from Object.)
Public method GetRouteData Returns information about the requested route. (Inherited from Route.)
Public method GetType Gets the Type of the current instance. (Inherited from Object.)
Public method GetVirtualPath Returns information about the URL that is associated with the route. (Inherited from Route.)
Protected method MemberwiseClone Creates a shallow copy of the current Object. (Inherited from Object.)
Protected method ProcessConstraint Determines whether a parameter value matches the constraint for that parameter. (Inherited from Route.)
Public method ToString Returns a string that represents the current object. (Inherited from Object.)
Top

ServiceRoute is derived from Route. When the ServiceRoute constructor is called, 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 . 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

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ
Routes not working?
You need this on your service

[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Required)]
public class MyService 

You need this in web.config
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" />

Make sure HTTP Redirection feature is enabled for IIS 
Routing won't work if HTTP Redirection is not installed.  Open Control Panel / Programs / Turn Windows Features on or off
Look under World Wide Web Services / Common HTTP Features
Check HTTP Redirection
http://blogs.msdn.com/b/rjacobs/archive/2010/06/30/system-web-routing-routetable-not-working-with-iis.aspx