3

I've got a new server 2022 setup I'm just getting up and running, and when pulling a page from IIS, I get a 500 error if I use the name in the URL, but get a 404 if using IP. The difference between the two URLs it what is throwing me off, so I honestly don't know where to look next. Why would a 500 error be thrown? Name lookup resolves to the same IP that I am using and getting the 404 error.

2
  • iisreset on the server, ipconfig /flushdns (admin elevated) on the client, wait 5 minutes, retry. Any relation to Peter Piper whom picked a peck of pickled peppers. Jun 6 at 1:24
  • If you read more about site bindings, the reason should be very clear, docs.jexusmanager.com/tutorials/…
    – Lex Li
    Jun 7 at 1:00

1 Answer 1

2

Within IIS in the Bindings for your website, have you got a binding entry for the IP and port with no hostname?

Since IIS allows you to have multiple websites, using multiple combinations of hostnames, IP addresses and port numbers, it determines which website you're trying to reach by taking your request and finding the website that has a matching binding. The combination of those three elements is always unique across the sites hosted on that server.

So in your case you'd want your site to have two bindings. One for the hostname/IP/port combination you have now, and the second almost identical entry with an empty hostname entry.

Note, if IIS is already listening on port 80/443 using that IP address and no hostname elsewhere (for instance in a default site that's still running) then it won't let you add it, but that could also explain why you're getting a different result as a different website is responding to the query. So while the URL connection is throwing a 500 error indicating an issue with the website itself, the IP 404 is indicating it's being sent elsewhere, but somewhere that perhaps the default page isn't found hense the 404 file not found error.

1
  • Thank you for this. I haven't done any sort of web dev work in.. let's say a larger number of years, so it never occurred to me that the hostname bit of the URL would be used for more than just the DNS lookup to find the IP (much simpler times back on the early web). I'll give some of this a look when i get back to it tomorrow or the day after.
    – CraziFuzzy
    Jun 6 at 5:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .