What would make a Custom 404 page suddenly stop working and show 500 instead

aspcustom-errorsiis-7.5

I have a Custom 404 page written in classic ASP that's worked well for a couple of years.
Suddenly, instead of seeing he expected nice 404, instead we're seeing a 500- internal server error.

There's nothing been changed in the IIS config (not deliberately, anyway).

Is this just IIS having a tantrum, running out of something? Might a restart fix it?
Or is this a sign of something more serious?

IIS 7.5 on Windows 2008 R2.

At Nathan C's instigation, I've remote desktopped to the server and run this locally, and I get a more detailed error response. Top tip, by the way: didn't realise you could get a different result locally!

It seems to be saying that there's something wrong with the config.

I have two custom error pages, one for 404 and one for 410.

The 410 one works fine.

The detailed error response seems to be somehow confusing the two:

Cannot add duplicate collection entry of type 'error' with combined key 
attributes 'statusCode, subStatusCode' respectively set to 410,-1.

I've looked in the web.config and the errors section contains:

<httpErrors errorMode="Custom">
            <remove statusCode="404" subStatusCode="-1" />
            <error statusCode="410" path="/custom410.asp" responseMode="ExecuteURL" />
            <error statusCode="404" path="/custom404.asp" responseMode="ExecuteURL" />
</httpErrors>

It strikes me that something is wrong with that page. It references the 404 twice but the 410 only once; there's either something extra or something missing.

But I'm not sure how it's meant to look.

Best Answer

IIS 7 is very picky with its configuration files as you've noticed. To fix, delete the entire httpErrors section from web.config, reload IIS, then use the "Error Pages" option in IIS Manager to add what you need.