1

Might seem like a strange question. But I want to be able to force 500 internal server errors (not errors with my code, but error 500 IIS).

Any sure bet way to do this?

I need to be able to test how other systems react that are connecting when the server returns Internal Server error 500.

I saw this question:

How to force IIS to throw an exception

Problem with this is I can already do this. If I do it this way, I have more control than with the IIS internal errors. Or at least I think I have more control.

I don't want to mimic a 500 error. I need to be able to see all the aspects of the 500 error IIS returns (content, headers, etc).

The purpose is that I need to be able to CHANGE those things if possible. And know I changed them.

One example of what I need to do is set a short cache time for these internal 500 errors (without affecting other responses).

userlite
  • 479
  • 1
  • 5
  • 13
  • With URL Rewrite module you can certainly return 500 responses from IIS, by defining what conditions/patterns you like, https://learn.microsoft.com/en-us/iis/extensions/url-rewrite-module/creating-rewrite-rules-for-the-url-rewrite-module – Lex Li Mar 06 '19 at 02:11
  • This is helpful but I don't think it's quite what I need. I need to be able to examine and handle the actual response the server gives when it gets an internal error. In particular, I need to see what cache headers are with the hopes the at I can change them somehow for internal 500 errors only. But there may be other things I want to review and configure. Ideally, I want to configure something that creates a state where there's an error. I know I've done it before on accident :) Now I want to do it on purpose. – userlite Mar 06 '19 at 16:15
  • Edit the question to include that please. – Lex Li Mar 06 '19 at 16:16
  • Updated the question. – userlite Mar 06 '19 at 18:02

1 Answers1

1

This worked for me, I configured IIS limits to zero connections. Any requests gives

HTTP/1.1 503 Service Unavailable\r\n

Not exactly what you asked for, but perhaps close enough?

enter image description here

Michael Levy
  • 13,097
  • 15
  • 66
  • 100