Is it possible to run a native thread in an IIS platform app that has a C ++ app installed?

We are hosting a C ++ WebServices application in IIS and we find that when we try to start our own C ++ threads, IIS has fit and crashes. Threads are based on boost.thread, which explicitly goes down to the standard Windows threading API.

The reason I need to start streaming is listening to multicasts from our mid-tier server to update the local cache. If you don't write another process to listen to us, I'm at a loss what else I can do.

So the question is, should this work? Are there any restrictions on this kind of operation with IIS?

+1


source to share


4 answers


It looks like you are creating a persistent thread that lives longer than the lifespan of the request that initiates it. You don't mention, it's ASP.NET C ++ / CLI, Managed C ++, or an extension or ISAPI filter, or even CGI.

Conceptually, the code that is called by IIS should only "live" for the lifetime of the request. Code that lasts longer will be dominated by IIS recycling for application pools.



Your best bet is to have another process that listens for notifications and maintain a cache in that process. Then you can use shared memory (see Boost.Interprocess ) to access that cache from your web service.

+3


source


I don't know about C ++, but in my ASP.NET ASP.NET application, I create threads and it works fine. Are "real" .NET streams? I don't know ... but they behave like you want the thread to behave. Maybe you can only have a portion of your ASP.NET C # application?



0


source


Without recording another process to listen to us I am at a loss what else I can do.

There are many other solutions besides using extra thread. For example polling + non-blocking IO would be one option.

0


source


Thread creation is probably not a problem - this is what you are doing in that thread that might be. I would look at code that shares objects that are also used by streams created by IIS.

0


source







All Articles