0

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.

n179911a
  • 125
  • 1
  • 8
  • Does this answer your question? [Configure IIS Express for external access to VS2010 project](https://stackoverflow.com/questions/5433786/configure-iis-express-for-external-access-to-vs2010-project) – Lex Li Apr 02 '22 at 02:47

1 Answers1

0

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)
  • Thanks. I tryed your solution #1 and I see 'IP 10.0.0.47 successfully added'. But when I go to https:10.0.0.47:44347, I see get bad host name – n179911a Apr 01 '22 at 19:24
  • I also try your #2, I change the config/applicationhost.config file in my .vs directory. I replace localhost with my ip address. But after I re-run my app in VS, i can't load either https://localhost:mport or https:myipaddress:myport – n179911a Apr 01 '22 at 20:12
  • Try to run the VS as an **Administrator** and set the applicationhost.config file like this `::` You can leave the ip-address and host-name empty in order for IIS-Express to listen on every IP and hostnames, like: `:44347:` – Artin Esrailian Apr 02 '22 at 08:44