I don’t know if my experience matches exactly the descriptive scenario, but I think that it can at least be an inspiration.
In my solution, I have four different cloud services, each of which has a web role, and everyone should know that the URLs of other services are working correctly. When I'm in production, I know exactly the URLs of all my services, and I can link to each service by its domain name. But when this time is debugging, it can be a nightmare, because there is no way to associate a cloud service with a specific IP address (and port), and DevFabric cannot guarantee that a particular cloud service supports the same address between two different debugging sessions.
I solved the problem with a simple technique:
In my WebRoles, I always refer to a domain name such as debug.myservice.com or debug.myotherservice.com .
The local IP address is resolved using the hosts file , which you can find in:
windows/system32/drivers/etc/hosts
add some simple operators, for example:
127.0.0.1 debug.myservice.com 127.0.0.2 debug.myotherservice.com
This solves the problem, but can be very boring because you need to manually update the hosts file every time you start a new debugging session.
But there is a simple and powerful solution. You know that you can set up a simple script run that runs every time the cloud service is initialized, you can find here:
http://msdn.microsoft.com/en-us/library/windowsazure/hh180155.aspx
You can also run various scripts when you are working in the cloud or in the emulator.
I run a script that automatically updates the hosts file every time my cloud service is initialized in the emulator environment (and only in the emulator).
Here's the script:
IF "%ComputeEmulatorRunning%" == "true" ( cd Startup UpdateDnsHostsOnDebugEnv.exe MyCompany.MyService.Site.WebRole debug.myservice.com cd.. )
and here is what you need to add to ServiceDefinition.csdef in order to run the script on startup:
<Startup> <Task commandLine="Startup\UpdateDnsHosts.cmd" executionContext="elevated" taskType="foreground"> <Environment> <Variable name="ComputeEmulatorRunning"> <RoleInstanceValue xpath="/RoleEnvironment/Deployment/@emulated" /> </Variable> </Environment> </Task> </Startup>
Pay attention to the use of the UpdateDnsHostsOnDebugEnv.exe program. This is a simple console application that I wrote, just run csrun.exe and analyze the result to extract the local endpoint address of this role and update the hosts file .
I hope for this help.