Need some help with the best approach that someone may have taken in the past for the following problem...
Hosting a WCF via a windows service calling a third party COM. The COM is unfortunately STAThead meaning that it only ever uses one core when run under one process scope.
To get around the issue I want to duplicate the windows service (which I have easily done using differing service names during install) creating another process scope so the COM interop will use another core.
Problem: How do I host each service under a differing address so that clients can call whichever service they want to consume the WCF methods?
If I use differing endpoints and point each windows service at a different one I get an error message stating that only one host is allow for each base address.
Can I add multiple base address (differing port maybe) for the same protocol and still link them to differing host services?
Examples would be great :).
It sounds to me like you really want to have multiple instances of this COM object used by the WCF service. You could spin up new threads (each STA) that instantiate and use their own COM object so that you can be using more than one of these COM objects at once. You, of course, will have to communicate any results back to the WCF thread.
If you want to host more than one instance of the WCF Service, it depends on how you're hosting. In ii6, you can simply create another .svc file. That will run the service in the same process as everything else in that application pool. You can get the service to run in a different process by assigning it a different application pool. I'm not sure if you can do this on a per .svc basis. If you're using IIS 7 you can either do the .svc thing or use the Windows process activation service (WAS) support in IIS7, in which case you basically create another element in the config. I believe you can use WAS in Windows Server 2008 R2 without really using IIS...