Both WCF REST and Web APIs can share the same port if the path is different.
For instance,
// Starting WCF service in port 13375 (Running in Process 1)
ServiceHost wcfServiceHost = new ServiceHost(typeof(StaffIntegrationService));
wcfServiceHost.addServiceEndPoint(typeof(IStaffIntegrationService), webHttpBinding, "http://localhost:13375/wcf");
wcfServiceHost.open();
// Start WebAPI in 13375 (Running in Process 2)
using (WebApp.Start<Startup>(url: "http://localhost:13375/api"))
{
Console.WriteLine("Service is started");
}
Both WCF and the web API worked successfully and listened on port 13375. Under the hood, the HTTP.SYS module takes over this port exchange.
source
share