Expose WCF services that belong to an Area in MVC app at a routed path

I've got a WCF service (lets say TestService.svc sitting inside the services directory of an Area in an MVC app. This area is combined into the main app. The area is called content.

The routes have been setup and the area works fine. To access the Index action on the Home controller I can do either:




The SVC file however can only be accessed via:


The URL must include the areas directory, I can't access it directly via http://my-host/content/services/TestService.svc. If I try I am given an error 404.

Is there a way to setup the application so that it routes the SVC request through the same route table as the controllers? I don't want to have to use areas for the services.


If you have the liberty to use .Net 4.0 you might want to consider making your WCF service available via a ServiceRoute rather than via a .svc file.

This will enable you to avoid having the TestService.svc file with a TestService.svc.cs code-behind. In your Global.asax.cs you will have the following:

public static void RegisterRoutes(RouteCollection routes, IUnityContainer container)
    ... other MVC route mapping ....
    routes.Add(new ServiceRoute("TestService", new ServiceHostFactory(), typeof(LoaEvents)));

Your service should then be accessible via http://my-host/TestService.

You might be able to change the "TestService" argument to "/content/services/TestService" or something that works better for your needs.

Need Your Help

How to make a div fill a remaining horizontal space?

html css css3 width responsive

I have 2 divs: one in the left side and one in the right side of my page. The one in the left side has fixed width and I want the one of the right side to fill the remaining space.

How can I set up a configuration file for .NET console applications?

.net configuration web-config app-config console-application

Is it possible to use a ".net configuration" file for a .NET console application?