different ip address generated when using azure link

152 Views Asked by At

I have this code on how to get my IP address. Locally the code is running and I got my IP address correctly, but when I run this code using link in azure different ip address is generated. So for example this is my correct ip address: "ipaddress": "136.158.26.238",

azure link: https://mysite.cloudapp.azure.com/mywebsvc/mywebsvc.svc/rest/generateip?username=testing3 I got an ip address: "ipaddress": "13.67.90.14",

Help is highly appreciated.

using System.Net;

ipaddress = new WebClient().DownloadString("https://ipv4.icanhazip.com/").Replace("\n", "").
1

There are 1 best solutions below

0
AjayKumarGhose On

AFAIK, When you are testing your application in local the IP ADDRESS should be shown as per your device/system . But when you have deployed your application to azure and trying to get IP Address as local which is quite not possible . The IP ADDRESS should be different from your local.

The IP ADDRESS should shown in azure when you run the above code for the app service deployed in azure displays the public IP address.

For more information MICROSOFT DOCUMENTATION.