We're running a MVC 5 application on .Net 4.7.2, hosting it with IIS 10. Investigating a application freeze for two minutes, I came to the conclusion that the configured IIS 404 error page and the application redirect logic bounced off each other.
Deleting the IIS error page, it gets even stranger: Now I see the default IIS error above our page when a 404 is thrown:
The "1" is right at the start of the body, therefore I guess it must be the IIS inserting the error message. I've removed the error page on the site as well as on the IIS itself. I've also changed the text on
%SystemDrive%\inetpub\custerr\\404.htm
to check if it still gets fetched, but that's not the case. Unfortunately, googling for this kind of issue, I usually find just questions about the 404 itself or general help for error pages like https://learn.microsoft.com/en-us/iis/configuration/system.webserver/httperrors/, but none of them mention the appending of the message.
As we have our custom error page in the application, I don't want the IIS error to be shown. Is there some sort of hidden IIS logic I'm not aware of, which would do that?
Edit solution: Someone added a new IHttpModule, which performs a flush on the response. This is generally a very bad idea, see for example here: https://forums.iis.net/t/993221.aspx?Response+Flush+breaks+IIS+s+Custom+Errors+.
I guess because of the flush and the httpErrors existingResponse=auto
, the IIS didn't clear the response stream but inserted his error beforehand.
To circumvent the problem, I've configured it to existingResponse=PassThrough
, as we have a custom error page anyway.