3
votes

We have an Azure application, which has a worker role and a web role, and the worker role has to know the web role address exposed to outside. That's because, web role include some Web API that worker role can use, so we need to know the exactly url address of web role.

Any way to get that?

1
If I understand correctly, if your web and worker role are deployed in a cloud service named abc you would want to find out the URL abc.cloudapp.net programmatically. Is my understanding correct? or if abc.cloudapp.net is mapped to a custom domain name (say mywebsite.com) you would want to find mywebsite.com programmatically? - Gaurav Mantri
@GauravMantri actually, we don't need to know the exactly domain name which can be seen by user, we just want to use it internally, which might be the IP address (including port) of running web role instance. - Jerry Bian

1 Answers

2
votes

You should look into Role, RoleInstance, RoleInstanceEndpoint classes in Microsoft.WindowsAzure.ServiceRuntime Namespace. Using these you should be able to find the IP address and Port of all the role instances.