wcfiisvirtual-directorywcf-routing

Can I deploy multiple instances of WCF service on IIS with same namespace?


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?


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.