Did you check the binding is IIS? (inetmgr.exe) It may not be registered to accept all hostnames on 8080.
For example, if you set it up for mysite.com:8080 and hit it at localhost:8080, IIS will get the request but not have a hostname binding to match so it rejects.
Outside of that, you should check the IIS logs (C:\inetpub\logs\wmsvc#) on the server and see if you are seeing your request. Then you'll know if its a problem on your client or on the server itself.
I'm not sure if this was your problem but for anyone that's trying to access his web application from his machine and having this problem:
Make sure you're connecting to 127.0.0.1 (a.k.a localhost) and not to your external IP address.
Your URL should be something like http://localhost:8181/ or http://127.0.0.1:8181 and nothttp://YourExternalIPaddress:8181/.
Additional information:
The reason this works is because your firewall may block your own request. It can be a firewall on your OS and it can be (the usual) your router.
When you connect to your external IP address, you connect to you from the internet, as if you were a stranger (or a hacker).
However when you connect to your localhost, you connect locally as yourself and the block is obviously not needed (& avoided altogether).
Check your local hosts file (C:\Windows\System32\drivers\etc\hosts for example). In my case I had previously used this to point a URL to a dev box and then forgotten about it. When I then reused the same URL I kept getting Bad Request (Invalid Hostname) because the traffic was going to the wrong server.
I saw the same error after using msdeploy to copy the application to a new server. It turned out that the bindings were still using the IP address from the previous server. So, double check IP address in the IIS bindings. (Seems obvious after the fact, but did not immediately occur to me to check it).
Don't forget to bind to the IPv6 address as well! I was trying to add a site on 127.0.0.1 using localhost and got the bad request/invalid hostname error. When I pinged localhost it resolved to ::1 since IPv6 was enabled so I just had to add the additional binding to fix the issue.
This solved my problem (sorry for my bad English):
open cmd as administrator and run command (Without the square brackets): netsh http add urlacl url=http://[ip adress]:[port]/ user=everyone
in documents/iisexpress/config/applicationhost.config and in your root project folder in (hidden) folder: .vs/config/applicationhost.config you need add row to "site" tag: <binding protocol="http" bindingInformation="*:8080:192.xxx.xxx.xxx" />
open "internet information services (iis) manager"
(to find it: in search in taskbar write "Turn Window features on or off" and open result and then check the checkbox "internet information service" and install that):
in left screen click: computer-name --> Sites --> Default Web Site and
For Visual Studio 2017 and Visual Studio 2015, IIS Express settings is stored in the hidden .vs directory and the path is something like this .vs\config\applicationhost.config, add binding like below will work
Double check the exact URL you're providing.
I saw this error when I missed off the route prefix defined in ASP.NET so it didn't know where to route the request.