Invalid Request - Invalid IIS7 Host Name

When I try to hit my web application on port 8080, I get the following error

Invalid request - invalid host name
HTTP Error 400. Invalid request host name.

I don’t even know where to start diagnosing this problem.

+75
iis-7
Jan 28 '11 at 17:17
source share
12 answers

Have you checked the IIS binding? (inetmgr.exe) It cannot be registered to accept all host names on the 8080.

For example, if you configured it for mysite.com:8080 and clicked it on localhost: 8080, IIS will receive the request, but will not bind the hostname to it to reject it.

In addition, you should check the IIS logs (C: \ inetpub \ logs \ wmsv #) on the server and see if you see your request. Then you will find out if there is a problem on your client or on the server itself.

+70
Jan 28 '11 at 17:59
source share

FWIW, if you just want to allow requests directed to any hostname / ip, then you can set the binding like this:

<binding protocol="http" bindingInformation="*:80:*" /> 

I use this binding to boot the VM using IE6 and then debug my application.




EDIT: when using IIS Express for debugging, the default for this configuration settings file is

 C:\Users\{User}\Documents\IISExpress\config\applicationhost.config 
+28
Sep 26 '13 at 15:11
source share

This page from Microsoft describes how to configure access to IIS Server Express from other computers on the local network.

In a nutshell:

1) from the command line with administrator rights:

 netsh http add urlacl url=http://[your ip address]:8181/ user=everyone 

2) In the Windows Security Firewall, create a new login rule for port 8181 to allow external connections

3) In applicationhost.config in node for your project add:

<binding protocol="http" bindingInformation="*:8181:[your ip address]" />

DO NOT add (as suggested in another answer):

<binding protocol="http" bindingInformation="*:8181:*" />

The above wildcard commitment broke my access from http://192.168.1.6:8181/

+22
Oct 29 '14 at 22:44
source share

So, I solved this by going to my site in IIS Manager and changing the hostname in the site bindings from localhost to *. Started to work right away.

Linking Sites in IIS

+21
Aug 10 '15 at 17:00
source share

Remember to also bind to an IPv6 address! I tried to add the site to 127.0.0.1 using localhost and received an invalid request / invalid host name. When I pinged localhost, he decided: 1, since IPv6 was enabled, so I just had to add an extra binding to fix the problem.

Linking IIS Sites

+4
Oct. 30 '15 at 21:45
source share

this problem is my problem:
(Sorry for my bad english)
1.) open cmd adminstor and execute the command (Without square brackets): netsh http add urlacl url = http: // [ip adress]: [port] / user = each

2.) documents / iisexpress / config / applicationhost.config and in the project root folder in the folder (hidden folder) .vs / config / applicationhost.config you need to add a line to the "site" tag:

3.) open "Internet information services (iis)", (if you do not find: intel in tasckbar write "Enable or disable window functions" and open Resulet, and then select the "Internet Information Service" and its installation) screen, click on the computer name → Sites → Default website, and then click on the “Linking” screen on the right screen, click the “Add” button that you need, and click “OK.”

4.) open the "Windows Firewall with Advanced Security", on the left screen, click "Incoming Message Rules", and then click the right port "New Rule ..." and click "Next", check TCP and your port and click "Next" ., check the box "Allow communication" and click "Next", check the box and click "Next", enter a name and click "Finish".

done.

+4
Jul 12 '17 at 22:05
source share

For Visual Studio 2017 and Visual Studio 2015 , IIS Express settings are saved in a hidden .vs directory, and a path such as this .vs\config\applicationhost.config , adding a binding, as shown below, will work

 <bindings> <binding protocol="http" bindingInformation="*:8802:localhost" /> <binding protocol="http" bindingInformation="*:8802:127.0.0.1" /> </bindings> 
+4
23 Oct '17 at 9:39 on
source share

I'm not sure if this was your problem, but for those trying to access their web application from their machine and having this problem:

Make sure you connect to 127.0.0.1 (aka localhost ) and not to the external IP address.

Your URL should be something like http://localhost:8181/ or http://127.0.0.1:8181 and not http://YourExternalIPaddress:8181/ .




Additional Information:
The reason for this is because your firewall might block your own request. It can be a firewall in your OS, and it can be (normal) your router.

When you connect to your external IP address, you connect to you from the Internet, as if you were a stranger (or hacker).
However, when you connect to the local host, you connect locally as to yourself, and the block is clearly not needed (and generally avoided).

+3
Jan 26 '13 at 9:26
source share

You can use the CMD tool for Visual Studio 2005/2008/2010. Run it as admin and write

 aspnet_regiis -i 

Finally, I can successfully launch my application.

+2
Jul 28 '12 at 4:13
source share

Check the local hosts file (for example, C: \ Windows \ System32 \ drivers \ etc \ hosts). In my case, I previously used this to specify a URL in a dev box, and then forgot about it. When I used the same URL again, I kept getting Bad Request (Invalid Hostname) because the traffic was going to the wrong server.

+1
Jul 25 '13 at
source share

I got this error when I tried to call a web service using "localhost". I fixed it using the actual IP address instead (192.168 ...)

+1
Jun 25 '14 at
source share

I saw the same error after using msdeploy to copy the application to the new server. It turned out that the bindings still use the IP address from the previous server. So double check the IP address in IIS bindings. (It seems obvious after the fact, but I didn’t have to check it right away).

0
Jun 03 '15 at 20:49
source share



All Articles