Bad Request - Invalid Hostname IIS7

后端 未结 15 2113
一个人的身影
一个人的身影 2020-12-05 03:53

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

Bad Request - Invalid Hostname
HTTP Error 400. The request hostname is inval

相关标签:
15条回答
  • 2020-12-05 04:08

    If working on local server or you haven't got domain name, delete "Host Name:" field.

    0 讨论(0)
  • 2020-12-05 04:11

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

    aspnet_regiis -i
    

    At last I can run my app successfully.

    0 讨论(0)
  • 2020-12-05 04:14

    FWIW, if you'd like to just allow requests directed to any hostname/ip then you can set your binding like so:

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

    I use this binding so that I can load a VM with IE6 and then debug my application.


    EDIT: While using IIS Express to debug, the default location for this option's config file is

    C:\Users\{User}\Documents\IISExpress\config\applicationhost.config
    
    0 讨论(0)
  • 2020-12-05 04:15

    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 not http://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).

    0 讨论(0)
  • 2020-12-05 04:15

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

    0 讨论(0)
  • 2020-12-05 04:18

    So, I solved this by going to my website in IIS Manager and changing the host name in site bindings from localhost to *. Started working immediately.

    0 讨论(0)
提交回复
热议问题