IIS thinks webservice is Idle

The problem even is that I set the threads as "thrd.IsBackground = false". iis does not think that it works, although these are lengthy processes. If I do not turn off the standby mode for the application pool, it will shut down because it thinks it is idle. In addition, if I use the new version, it interrupts all threads that are started, instead of waiting for the true downtime of all processes before reusing and using the new code. What am I doing wrong here? this is my webservice code:

  /// <summary>
    /// Summary description for LetterInitiateWS
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.ComponentModel.ToolboxItem(false)]
    // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
    // [System.Web.Script.Services.ScriptService]
    public class LetterInitiateWS : System.Web.Services.WebService
    {

        private static Processor processor = new Processor();
        [WebMethod]
        public void ExecuteBulkRun()
        {
            var thrd = new Thread(() => ThreadExecuteBulkRun());
            thrd.IsBackground = false;
            thrd.Start();

        }

        [WebMethod]
        public void ExecuteTemplateBulkRun(string templateCategory, string TemplateType)
        {
            var thrd = new Thread(() => ThreadExecuteTemplateBulkRun(templateCategory, TemplateType));
            thrd.IsBackground = false;
            thrd.Start();

        }

        private void ThreadExecuteBulkRun()
        {
            processor.ExecuteBulkRun();
        }
        private void ThreadExecuteTemplateBulkRun(string templateCategory, string TemplateType)
        {
            processor.ExecuteTemplateBulkRun(templateCategory, TemplateType);
        }

    }
}
+3
source share
2 answers

IIS is not stable enough to run long processes. It is intended for interaction such as request and response.

- , Windows. , -.

+2

, , - Application_End. , , , , .

0

Source: https://habr.com/ru/post/1790837/


All Articles