Question

I need to deploy the same WCF service on multiple virtual directories with the same site on IIS. Does this cause a problem, if I have the same namespace for all these instances?

Was it helpful?

Solution

In BizTalk - the duplicate namespace would matter, but with IIS Virtual Directories as a boundary there should be no issues.

You could register a service using multiple endpoints via MVC service routing and avoid creating virtual directories altogether.

ServiceHostFactory serviceHost = new ServiceHostFactory();
RouteTable.Routes.Add(new ServiceRoute("SoapService", serviceHost, typeof(SoapService)));
RouteTable.Routes.Add(new ServiceRoute("directory1/SoapService", serviceHost, typeof(SoapService)));
RouteTable.Routes.Add(new ServiceRoute("directory2/SoapService", serviceHost, typeof(SoapService)));

If you are using classic service activation with physical SVC files, you should be able to point each virtual directory to the same physical location where the SVC files exist.

OTHER TIPS

Technically, a service isn't responsible for its hosting, that the .svc file (or service entry in the config). There should be no reason you would have any problems, since each instance is at a different endpoint. People do this even within the same virtual directory, hosting the same service multiple times with a different binding at each endpoint. For example, my security service has the same service hosted with different security at endpoint depending on whether you want to authenticate with username/password, Windows Auth, or existing token.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top