Routing URLs to Web Services
The standard URL format for WCF web services is not very elegant. Here is an example from the Ajax script in the ListEvents.aspx
page:
url: '/TriathlonService.svc/GetEventData',
We can use the routing feature to improve the URLs of the web service. However, what we can do is much more limited than for web pages. In essence, we can replace the name of the web service file (Triathlon.svc
) with something else. We can't use routing to change the name of the web service method (GetEventData
in this case), and we can't use variable segments in the routed URL.
To begin, we must add a reference to the System.ServiceModel.Activation
assembly. In Visual Studio, select Project Add Reference, click the .NET tab, and select ...
Get Applied ASP.NET 4 in Context now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.