How to get DNS name from REST service which is con

2019-08-03 09:43发布

I have confirmed with that it's not possible to get DNS Name and environment details (staging vs production) without certificate & management API.

However let's consider my case in that my startuptask(exe) consume REST service to post some data so in that REST service can i do some trick to get DNS name?

I have tried with following

HttpContext.Current.Request.UserHostName however it is same as HttpContext.Current.Request.UserHostAddress

Please give me suggestion if anyone have you did this type of trick.

Update

Using HostName & HostAddress i am able to get IP of that webrole (confirmed with browser request) but when i try that with nslookup command then it says me that Non-existent domain

Does Azure not support reverse lookup?

Thanks in Advance.

1条回答
萌系小妹纸
2楼-- · 2019-08-03 10:32

After I study the above details I would say that using above trick, you are getting the external facing VIP address about your service.

Lets consider in that case it would be something as below and if you have port 80 configured with your application you could use this IP address in any browser to verify and you did:

65.52.14.112

Now let's run nslook on IP address and it sure returns what you said:

C:\myTools>nslookup 65.52.14.112
Server:  router.belkin
Address:  192.168.2.1

*** router.belkin can't find 65.52.14.112: Non-existent domain

Now for a second lets consider you know the hosted service name (it is my service and I know the name) so lets try to use nslookup with that:

C:\myTools>nslookup azurevmassistant.cloudapp.net
Server:  router.belkin
Address:  192.168.2.1

Non-authoritative answer:
Name:    azurevmassistant.cloudapp.net
Address:  65.52.14.112

As you can see above the hostname resolves the IP address and that's it. Also you would need to understand in both of the above case you were hitting the Windows Azure loadbalancer not the service itself.

I am able to verify that as of now the Windows Azure does not support "reverse lookup" and if you think that is important it is great chance to let your voice heard and submit the request here: http://www.mygreatwindowsazureidea.com/pages/34192-windows-azure-feature-voting

查看更多
登录 后发表回答