<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/using-dynamic-wcf-service-routes-0r3p0yxbc" -->

---
title: Using dynamic WCF service routes | daily.dev
description: A walkthrough of building a custom DynamicServiceRoute class that wraps ASP.NET's RouteBase and WCF's ServiceRoute to support route data in WCF service URLs,...
canonical: https://daily.dev/posts/using-dynamic-wcf-service-routes-0r3p0yxbc
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Using dynamic WCF service routes | daily.dev
og:description: A walkthrough of building a custom DynamicServiceRoute class that wraps ASP.NET's RouteBase and WCF's ServiceRoute to support route data in WCF service URLs,...
og:url: https://daily.dev/posts/using-dynamic-wcf-service-routes-0r3p0yxbc
og:image: https://api.daily.dev/og/posts/0r3P0yxbC.png
og:image:alt: Using dynamic WCF service routes
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Using dynamic WCF service routes

**[Maarten Balliauw](https://daily.dev/sources/maartenballiauw)** · 5 min read · 0 upvotes · 0 comments

## Summary

A walkthrough of building a custom DynamicServiceRoute class that wraps ASP.NET's RouteBase and WCF's ServiceRoute to support route data in WCF service URLs, something ServiceRoute lacks natively. The technique allows a single WCF service (such as an OData feed) to be addressed per-customer, e.g. MyService/Contoso vs MyService/AdventureWorks, without requiring multiple hardcoded ServiceRoutes or recompilation. Full code for the constructor, GetRouteData, GetVirtualPath, and GetHttpHandler is provided, along with a downloadable source file.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://blog.maartenballiauw.be/posts/2011-05-09-using-dynamic-wcf-service-routes>

## Questions this post answers

### How do I make a WCF ServiceRoute support route data like customer name in the URL?

Wrap ServiceRoute and ASP.NET's Route/RouteBase in a custom class instead of inheriting ServiceRoute directly, since it is sealed-like and hard to extend. Append a catch-all {*servicePath} parameter to the path prefix, generate a hidden internal virtual path tied to the service type and a GUID, and in GetHttpHandler rewrite the incoming request path to that internal URL before delegating to the inner ServiceRoute's handler.

_daily.dev surfaces practical WCF and ASP.NET routing techniques like this for developers wiring up multi-tenant services._

### Why can't WCF's ServiceRoute handle multiple customer-specific URLs for the same service without recompiling?

ServiceRoute, unlike ASP.NET routing, does not support route data, so a single registered route can't map paths like MyService/Contoso and MyService/AdventureWorks to the same service dynamically. Normally this would require creating a separate ServiceRoute per customer, which demands recompilation whenever a new customer is added.

_Developers hitting WCF routing limits can find workaround patterns like this through daily.dev._

## Similar posts on daily.dev

- [Create a WCF Web Service in Visual Studio 2015](https://daily.dev/posts/create-a-wcf-web-service-in-visual-studio-2015-lhamcmupt) · C\# Corner · 1 upvotes · 0 comments
- [ASP.NET Core Controllers: A Practical Guide to Building REST Endpoints](https://daily.dev/posts/asp-net-core-controllers-a-practical-guide-to-building-rest-endpoints-qbrdx5rqi) · We Are .NET · 0 upvotes · 0 comments
- [URL Pattern Matching in .NET](https://daily.dev/posts/url-pattern-matching-in-net-eoobxiadc) · Meziantou · 29 upvotes · 4 comments

---

Tags: [#.net](https://daily.dev/tags/.net), [#c#](https://daily.dev/tags/c#)

[View this post on daily.dev](https://daily.dev/posts/using-dynamic-wcf-service-routes-0r3p0yxbc)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Using dynamic WCF service routes","url":"https://daily.dev/posts/using-dynamic-wcf-service-routes-0r3p0yxbc","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/using-dynamic-wcf-service-routes-0r3p0yxbc"},"datePublished":"2026-10-04T13:05:48.491Z","dateModified":"2026-10-04T13:13:37.774Z","description":"A walkthrough of building a custom DynamicServiceRoute class that wraps ASP.NET's RouteBase and WCF's ServiceRoute to support route data in WCF service URLs,...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/8335287c53aa7fe03d12e0410fbe9a7d?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/8335287c53aa7fe03d12e0410fbe9a7d?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"Maarten Balliauw","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Maarten Balliauw","logo":"https://media.daily.dev/image/upload/s--rOTg3VYO--/f_auto,q_auto/v1791119043/logos/maartenballiauw?_a=BAMAMicg0","url":"https://daily.dev/sources/maartenballiauw"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/using-dynamic-wcf-service-routes-0r3p0yxbc","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":".net,c#","timeRequired":"PT5M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Maarten Balliauw","item":"https://daily.dev/sources/maartenballiauw"},{"@type":"ListItem","position":3,"name":"Using dynamic WCF service routes"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/using-dynamic-wcf-service-routes-0r3p0yxbc#faq","mainEntity":[{"@type":"Question","name":"How do I make a WCF ServiceRoute support route data like customer name in the URL?","acceptedAnswer":{"@type":"Answer","text":"Wrap ServiceRoute and ASP.NET's Route/RouteBase in a custom class instead of inheriting ServiceRoute directly, since it is sealed-like and hard to extend. Append a catch-all {*servicePath} parameter to the path prefix, generate a hidden internal virtual path tied to the service type and a GUID, and in GetHttpHandler rewrite the incoming request path to that internal URL before delegating to the inner ServiceRoute's handler. daily.dev surfaces practical WCF and ASP.NET routing techniques like this for developers wiring up multi-tenant services."}},{"@type":"Question","name":"Why can't WCF's ServiceRoute handle multiple customer-specific URLs for the same service without recompiling?","acceptedAnswer":{"@type":"Answer","text":"ServiceRoute, unlike ASP.NET routing, does not support route data, so a single registered route can't map paths like MyService/Contoso and MyService/AdventureWorks to the same service dynamically. Normally this would require creating a separate ServiceRoute per customer, which demands recompilation whenever a new customer is added. Developers hitting WCF routing limits can find workaround patterns like this through daily.dev."}}]}
```

