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

Bạn đang xem: Iis 7

I don"t even know where lớn begin to diagnose this problem



Highest score (default) Trending (recent votes count more) Date modified (newest first) Date created (oldest first)
Did you kiểm tra the binding is IIS? (inetmgr.exe) It may not be registered lớn accept all hostnames on 8080.

For example, if you set it up for mysite.com:8080 & hit it at localhost:8080, IIS will get the request but not have a hostname binding lớn match so it rejects.

Outside of that, you should kiểm tra the IIS logs (C:inetpublogswmsvc#) 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 vps itself.


FWIW, if you"d like to just allow requests directed khổng lồ any hostname/ip then you can phối your binding lượt thích so:

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

Xem thêm: Các Trình Duyệt Web Nhanh Nhất Cho Pc, Laptop Hiện Nay, Top 7 Ứng Dụng Trình Duyệt Web Tốt Nhất Hiện Nay

EDIT: While using IIS Express to debug, the mặc định location for this option"s config file is




This page by Microsoft describes how lớn set up access to lớn IIS vps Express from other computers on the local network.

In a nutshell:

1) from a command prompt with admin privileges:

netsh http showroom urlacl url=http://:8181/ user=everyone2) In Windows Firewall with Advanced Security, create a new inbound rule for port 8181 khổng lồ allow external connections

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

Do NOT địa chỉ cửa hàng (as was suggested in another answer):

The above wildcard binding broke my access from

edited Apr 24, năm ngoái at 9:41
9,05288 gold badges4848 silver badges6161 bronze badges
answered Oct 29, năm trước at 22:44
53566 silver badges88 bronze badges
địa chỉ a phản hồi |
So, I solved this by going to lớn my website in IIS Manager & changing the host name in site bindings from localhost to lớn *. Started working immediately.


cốt truyện
answered Aug 10, 2015 at 17:00
1,0871111 silver badges1111 bronze badges
add a bình luận |
For Visual Studio 2017 & Visual Studio 2015, IIS Express settings is stored in the hidden .vs directory and the path is something lượt thích this .vsconfigapplicationhost.config, địa chỉ cửa hàng binding like below will work


tóm tắt
edited Aug 24, 2020 at 18:55
10.4k55 gold badges5050 silver badges6565 bronze badges
answered Oct 23, 2017 at 9:39
2,68366 gold badges4242 silver badges6363 bronze badges
địa chỉ a phản hồi |
If working on local server or you haven"t got domain name name, delete "Host Name:" field.

nói qua
answered Apr 29, 2020 at 14:31
8911 silver badge33 bronze badges
địa chỉ a comment |
Don"t forget to lớn bind to the IPv6 address as well! I was trying to địa chỉ cửa hàng a site on using localhost và got the bad request/invalid hostname error. When I pinged localhost it resolved khổng lồ ::1 since IPv6 was enabled so I just had to địa chỉ cửa hàng the additional binding to lớn fix the issue.


tóm tắt
answered Oct 30, năm ngoái at 21:45
Jeff CameraJeff Camera
5,25455 gold badges4141 silver badges5959 bronze badges
địa chỉ a phản hồi |
This solved my problem (sorry for my bad English):

open cmd as administrator & run command (Without the square brackets):netsh http showroom urlacl url=http://:/ user=everyone

in documents/iisexpress/config/applicationhost.config và in your root project thư mục in (hidden) folder: .vs/config/applicationhost.config you need địa chỉ row khổng lồ "site" tag:

open "internet information services (iis) manager"(to find it: in tìm kiếm in taskbar write "Turn Window features on or off" and xuất hiện result và then kiểm tra the checkbox "internet information service" và install that):

in left screen click: computer-name --> Sites --> mặc định Web Site andthen click in right screen "Binding"click địa chỉ cửa hàng buttonwrite what you need và press "OK".

open "Windows Firewall With Advanced Security",

in left screen press "Inbound Rules" and thenpress in right screen "New Rule..."check port & press Next,check TCP và your port and press Next,check "Allow the connection" và press Next,check all checkbox và press Next,write name and press Finish.