Quartz.NET Job Triggering Phantom PDF Generation Calls Minutes After Completion Due to IIS App Pool
TL;DR: Quartz.NET cronjob completes successfully but continues making HTTP requests to external PDF service 2-3 minutes later. Job logs show "finished" with 0 processed items, yet dozens of PDF generation calls still occur. Only happens in production, not test environments.
What i believe the Root Cause is:
IIS Application Pool recycling (configured every 510 minutes) terminates the app domain while async PDF generation operations are still running in background threads. These "orphaned" async operations complete after recycling and log their success messages, creating phantom calls.
Key Evidence:
Job completes at 14:45: "Generate XML Job Finished. New Changed Entries: 0"
PDF calls start at 14:48: "successfully attached pdf to receiptmail: 28006..."
Same receipt numbers appear multiple times in external service logs
Production-only issue (different IIS recycling schedule than in test env)
Job Execute method:
What i believe the Root Cause is:
IIS Application Pool recycling (configured every 510 minutes) terminates the app domain while async PDF generation operations are still running in background threads. These "orphaned" async operations complete after recycling and log their success messages, creating phantom calls.
Key Evidence:
Job completes at 14:45: "Generate XML Job Finished. New Changed Entries: 0"
PDF calls start at 14:48: "successfully attached pdf to receiptmail: 28006..."
Same receipt numbers appear multiple times in external service logs
Production-only issue (different IIS recycling schedule than in test env)
Job Execute method: