Make IIS Express works with http://127.0.0.1

I never notice that IIS Express doesn’t listen to web requests other than localhost. So, to my surprise, when I try http://127.0.0.1, I got HTTP 400, Bad Request instead.

 

127.0.0.1-Error

 

Change 127.0.0.1 to localhost and everything is fine.

localhost

 

Anyway, you can set your IIS Express to let it listen to a request for 127.0.0.1 easily.

1. Look for a file applicationhost.config. It’d be under /documents/IISExpress/config.

2. Go to <sites> section and look for your site. In this example, I have my web project named MyWeb.

iis-express-setting-before

3. Change localhost to 127.0.0.1

iis-express-setting-after

4. Stop IIS Express and run your web site again.

exit-iis-express

 

Now you should be able to access your web site thru 127.0.0.1 address now!

127.0.0.1-work

 

Hope this helps! 🙂

Advertisements

4 thoughts on “Make IIS Express works with http://127.0.0.1

  1. OMG this has been driving me INSANE. I just upgraded from Visual Studio 2013 to 2015 and my web app suddenly started giving 400 errors when trying to use 127.0.0.1

    Out of curiosity, do you have any idea why running under VS2015 would give a 400 error when VS2013 used to accept 127.0.0.1?

    Thankyou so much!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s