I have a long running stored procedure that imports lots of records from an old system and takes hours to execute. While executing maybe the IIS process needs recycling or web server needs restart or something else that caused the IIS process to end and accordingly aborted the execution of the stored procedure.
I've decided to run the stored procedure out of w3wp.exe process, in a disconnected environment.
Solutions:
Is there any other solution?
I personally prefer the Windows Service route. Lately I've used self-hosted WebApi which allows me to start a long running job from MVC (using HttpClient or System.Net.HttpWebRequest, etc).
CLR Assembly.
change your code as a class library, and import dll result of class library as an assembly function of SSMS, with this Code
CREATE ASSEMBLY myAssembly from 'E:\Projects\CL.dll'
now you can call it without any concern of IIS stop.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.