-1

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", "").
Codebling
  • 10,764
  • 2
  • 38
  • 66
woo25
  • 5
  • 6
  • Repeat of deleted post https://stackoverflow.com/questions/71467352/code-getting-ip-address-using-system-net-seems-to-block-in-azure – gunr2171 Mar 14 '22 at 23:02

1 Answers1

0

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.

AjayKumarGhose
  • 4,257
  • 2
  • 4
  • 15