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", "").
AFAIK, When you are testing your application in local the
IP ADDRESSshould be shown as per your device/system . But when you have deployed your application to azure and trying to getIP Addressas local which is quite not possible . TheIP ADDRESSshould be different from your local.The
IP ADDRESSshould 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.