Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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.

share|improve this question
    
If you visit the site from localhost, does it show the detailed error message? –  Nathan C Feb 28 at 12:57
    
@Nathan C Yes, it does. And I'm puzzled by what it says: It says: 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> –  Marc Wilson Feb 28 at 13:17

2 Answers 2

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.

share|improve this answer
    
I thought it looked odd. I'll try what you suggest- it does look as though something is corrupted. –  Marc Wilson Feb 28 at 13:47
    
Oh, this gets worse. I removed the section, did an IIS bounce, and then added back the 404 page. That worked fine (if differently) externally and internally. Then I added the 410 custom error back in- and we're back to square one. –  Marc Wilson Feb 28 at 13:56
    
That's...odd. It doesn't like the 410 status apparently. Let's see what else I can dig up. –  Nathan C Feb 28 at 13:59
    
Try removing the <remove /> stanza. It may not be needed to override the default. –  Nathan C Feb 28 at 14:03
    
What's really irritating is that it used to work. I've added a couple of new rewrite rules recently, to return 410's for some removed content, but the 404 and 410 used to work nicely side by side. Oh- and disabling the rewrite rules doesn't make the problem go away. –  Marc Wilson Feb 28 at 14:32

What seems to have done the trick is:

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

.. which implies that it was inheriting some behaviour from a higher level (though I'm damned if I can see where).

In that sense, it's a bit of a brute-force method, as I'm still not totally sure of the reason it broke in the first place. It may be that it's inheriting the behaviour from a stupid default setting (it's Microsoft; they have previous).

Thanks to Sam Morgan of Servwise for pointing me in the right direction.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.