My ASP.NET SOAP Web Service is getting "Out of memory" run-time error after a few hundred calls. The "Out of Memory" issue is happening because of my using of a third-party component in my web service. To solve the "Out of Memory" issue I'd like to restart my web service from within itself when it captures "Out of memory" run-time error.
I have found how to restart a web service using a "hacking" solution "How to restart asp.net application besides modifying web.config".
Question: Is there any other more "elegant" non-hacking ways to restart an ASP.NET web service (both SOAP and Web API) from within itself by, e.g., using a special .NET Framework API call? I'm using .NET Framework 4.0+ in my web service.