How can I cleanly end a program running under HttpPlatformHandler?

Smith, Roland 40 Reputation points
2023-12-05T20:21:39.21+00:00

I wrote a program that runs under HttpPlatformHandler and it works pretty well. The problem I am having is that I added code to exit if the program has been idle for too long. Sometimes after a program exit, the next request coming from a client results in a Bad Gateway error.

It appears that instead of launching another instance of my EXE, it is returning an empty response back to the client.

Is there a preferred way to cleanly shut down the EXE so that the handler can respond to the next request without an error?

Internet Information Services
{count} votes

Accepted answer
  1. Lex Li (Microsoft) 6,032 Reputation points Microsoft Employee
    2023-12-09T17:42:43.6+00:00

    Based on the discussion via comments, I think the answer is clear.

    Different from traditional ISAPI or managed module that dispatch individual requests to an extension, ARR and HttpPlatformHandler (both work as reverse proxy) expect the server administrator to configure a full-feature application server behind. So, for Java that means Tomcat or Jetty, and in your case your program needs to be able to handle multiple incoming requests at the same time.

    Since your program will be an application server, you shouldn't expect it to be shut down from time to time, but run continuously over a long period of time. With ARR setup, IIS won't even attempt to shut down your program, while HttpPlatformHandler honors application pool idle shut down and might shut down your program and later start it again.

    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.