vtortola
vtortola

Reputation: 35945

Get ServiceDefinition.csdef from an Azure instance

I need to get the original endpoint configurations from the .csdef file, how can I do it?

I cannot use RoleEnvironment.CurrentRoleInstance.InstanceEndpoints, because it gives me the internal/local port in the virtual IP. But I need to know which is the port is being shown to the public.

For example I have a FTP server with a tcp 21 end point, but when I check at runrime to that collection it can has something like tcp 5100. When I bind the FTP server to tcp 5100 and access the server through, for example, 127.0.0.1:21 it works perfectly.

But for example, when I need to establish the PASV mode, I have to send back the IP and port where the client should connect. I'll work out the IP, but how could I know the port that has been configured for PASV? the port in the previous collection is not ensured to be the same that is exposed in the public interface.

So basically, how may I get the original .csdef configuration?

Cheers.

Upvotes: 2

Views: 463

Answers (1)

Shaun Xu
Shaun Xu

Reputation: 4656

I'm not sure if this works with FTP but when using HTTP, it will returned the inner address and port if using HttpContext.Requst.Url. I was using Header["Host"] instead. Hope this helps.

Upvotes: 2

Related Questions