I have legacy C++ code that implements functionality that I want to expose as a RESTful web service. This C++ code has a few characteristics of interest: (a) it is not thread-safe and (b) its initialization is non-trivial.
Implementing it as a FastCGI application seemed ideal at first as such an app would have an event loop that would serialize the processing of requests. It is also my understanding that FastCGI is implemented on major web servers such that it will spawn multiple copies of the app and maintain a pool of processes each running my FastCGI app. Two concerns: (a) it seems like old technology and (b) I was never able to find a code sample that I could get to work on IIS. I only found two code samples and both were not well-maintained and up-to-date.
I also looked at ISAPI. However, it seems that IIS assumes that the code in the DLL is thread-safe. Also, there seems be no IIS facility that will manage a pool of worker processes each loading my DLL and distributing requests across them. Perhaps there is such a process pool facility and I just don't know it.
As I understand it, in IIS7 ISAPI is supported but I should favor the new module mechanism. The Windows Process Activation Service (WAS) sounds like it manages process pools. My questions are:
1) Am I generally on the right track with modules?
2) Is WAS going to manage my pool of processes? Any docs or samples on how to set this up?
3) Can a native module declare itself to be non-thread-safe such that IIS serializes requests that are sent to it?