'How to run the C# application from Visual Studio which can be accessed by 'https://{my ip address}:aport'

I have a ASP.NET C# application and I am able to run it locally on my machine. I see it is IIS Express is hosting my application.

I can access it using 'https://localhost:4374'.

But when I look up my ip address of my machine and then go https://{my ip address}:4374'. I get an error saying 'Bad Request - Invalid Host name'

Can you please tell me how can I configure ASP.NET C# application so that I can use it using https://{my ip address}:4374?

Thank you.



Solution 1:[1]

1st solution:

Steps:

Open command prompt as administrator

Type the following:

netsh http add iplisten ipaddress (YourIPAddress)

That's it. You should get:

IP address successfully added

2nd solution:

Steps:

  1. Search for IISExpress on your computer
  2. Open config/applicationhost.config file
  3. Search for localhost and replace with (YourIPAddress)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1