How can my ASP.NET webapp spawn a program in a new thread within the same Process?
I have an ASP.NET application which needs to run a command-line tool. I want to start it under the same process as the a开发者_高级运维pplication pool so it is subject to the IIS CPU throttling, etc. How can this be done?
This is not really possible. Think about how this works when you are using the command-line tool... the command line is really just a shell... when you luanch the app, it starts its own process... and in fact has nothing to do with the shell. The same thing would happen if you start the tool from an ASP.NET web app.
You'll have to come up with a different strategy for throttling the app if CPU hogging is an issue.
Sorry to be a little off topic but I'm assuming this process is rather intensive / long running seeing as you want it to be throttled. If this is the case, its not advisable to have the IIS worker process doing this work.
See Here for the reason why.
精彩评论