从 Azure 实例获取 ServiceDefinition.csdef
我需要从 .csdef 文件获取原始端点配置,该怎么做?
我无法使用 RoleEnvironment.CurrentRoleInstance.InstanceEndpoints,因为它为我提供了虚拟 IP 中的内部/本地端口。但我需要知道向公众展示的端口是哪个。
例如,我有一个带有 tcp 21
端点的 FTP 服务器,但是当我在 runrime 上检查该集合时,它可能有类似 tcp 5100
的内容。当我将 FTP 服务器绑定到 tcp 5100
并通过例如 127.0.0.1:21
访问服务器时,它工作得很好。
但例如,当我需要建立PASV模式时,我必须发回客户端应连接的IP和端口。我将计算出 IP,但我如何知道已为 PASV 配置的端口?不确保先前集合中的端口与公共接口中公开的端口相同。
那么基本上,我如何获得原始的 .csdef 配置?
干杯。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不确定这是否适用于 FTP,但使用 HTTP 时,如果使用 HttpContext.Requst.Url,它将返回内部地址和端口。我使用的是 Header["Host"] 。希望这有帮助。
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.