Last post Aug 08, 2017 09:32 PM by Raident
Aug 04, 2017 12:01 AM|Raident|LINK
As far as I can tell, all Tasks abort the moment the main thread returns. Is this some ASP.NET/IIS limitation, which forces the use of QueueBackgroundWorkItem?
Aug 04, 2017 07:28 AM|PatriceSc|LINK
AFAIK this is not particular to ASP.NET but just how it works behind the scene. It's just more visible in ASP.NET as each request is processed separately compared with maybe your prior experience with a Windows desktop app.
Depending on what you are doing you may to have a look first at async/.await.
Aug 04, 2017 09:29 AM|Billy Liu|LINK
Do you want to use QueueBackgroundWorkItem in Asp.Net?
The QueueBackgroundWorkItem is added at .NET Framework 4.5.2.
If you want to use it, please use Framework 4.5.2 or later, and it can only be used in ASP.NET managed app domain.
You could refer to link below for using QueueBackgroundWorkItem :
Disclaimer: This response contains a reference to a third party World Wide Web site. Microsoft is providing this information as a convenience to you. Microsoft does not control these sites and has not
tested any software or information found on these sites; therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. There are inherent dangers in the use of any software found
on the Internet, and Microsoft cautions you to make sure that you completely understand the risk before retrieving any software from the Internet.
Aug 07, 2017 04:42 AM|Raident|LINK
Hmm, parts of the codebase are shared with a console application, so is there any way to launch a background task that could potentially run for an hour or more without having to use ASP.NET-specific technologies like the aforementioned
Aug 07, 2017 09:33 AM|Billy Liu|LINK
Have you tried the BackgroundWorker?
You could refer to link below for more information:
Aug 08, 2017 09:32 PM|Raident|LINK
Thanks, I will give BackgroundWorker a try!