Score:3

IIS 10 (Server 2022) error 500 with name, 404 with ip

to flag

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.

Pimp Juice IT avatar
ch flag
`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.
Lex Li avatar
vn flag
If you read more about site bindings, the reason should be very clear, https://docs.jexusmanager.com/tutorials/binding-diagnostics.html#background
Score:2
us flag

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.

CraziFuzzy avatar
to flag
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.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.