I'm currently implementing a WCF REST service on a web role in Windows Azure, and I'm trying to add some communication between the instances of the role so that they can keep each other updated when, say, some data is updated in blob storage. What I'd like to do is host the same WCF service on both the external and internal HTTP endpoints of the web role. However, from what I've read, WCF is limited to just one base address per protocol when hosted in IIS. When I enable the internal HTTP endpoint for my role and try to start up my service using the WebServiceHostFactory, this is the error I get:
This collection already contains an address with scheme http. There can be at most one address per scheme in this collection.
Parameter name: item
I've Googled around a bit, and the one workaround I've seen in various places suggests adding a baseAddressPrefixFilter in the web.config. However, if I don't know the full URL for either endpoint before I run the app, I'm not sure how to get that to work.
Alternatively, this issue seems constrained to just IIS hosting, so is there some other hosting method I could use in Azure that would work? I would think self-hosting outside of any IIS context or whatever wouldn't be robust/secure enough, but I don't know for sure.
Does anyone know how to get around this issue? It seems like it would be a pretty common thing to want to host a web service on both endpoints of a web role. I'm relatively new to WCF, so there may be something obvious I'm missing. Any help is appreciated.