Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

500.19 Error In Web Garden Mode Only

My ASP.NET web app runs fine under IIS 7.5. But I want to make sure it's ready to run in a web farm. So I enabled web garden on my dev machine. (Set Maximum Worker Processes=2 in the app pool.)

Clicking around the site seems to go okay, but upon any AJAX request, I get 500.19 errors. The error is like:

The requested page cannot be accessed because the related configuration data for the page is invalid.

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

In my web config, I have this:

<system.webServer>
  <httpErrors>
    <error statusCode="404" path="Home/NotFound" />
  </httpErrors>

Looks fine to me, and I guess need it. But for fun I removed the httpErrors section. Then I get:

Unable to connect to the remote server

Of course I looked at MS's troubleshooting 500.19 errors. But I'm guessing the error is a red herring. The problem has something to do with my app pool or my code or something other than what the message is telling me. As I said, everything runs beautifully with 1 Max Worker Process.

Any ideas?

UPDATE: I have realized that the second error I mentionend, "Unable to connect to the remote server," was a real error caused by my application. So the <error> element in web.config was the cause of the 500.19 error (which masked the real error). And maybe I don't need this element because I have a similar element in system.web that seems to have the desired affect by itself.

Problem solved. However, I still wonder why there's no problem in single worker mode, and it breaks in web garden mode?

like image 883
Tim Scott Avatar asked Feb 24 '23 04:02

Tim Scott


1 Answers

In your web.config, if you're changing custom errors you first have to remove the existing custom error, for example:

<httpErrors>
    <remove statusCode="404" subStatusCode="-1" />
    <error statusCode="404" path="http://google.com" responseMode="Redirect" />
</httpErrors>

IIS7 is quite good and the clue is often in the error message:

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

like image 113
Kev Avatar answered Apr 08 '23 17:04

Kev