Reputation: 52922
I tried this:
BackgroundWorker bw = new BackgroundWorker();
bw.DoWork += (o, e) =>
{
SendConfEmail();
};
bw.RunWorkerAsync();
but it didn't work. SendConfEmail takes a while to run. I guess it's because BackgroundWorker is designed for winforms not webforms.
Any ideas how I can solve the problem?
Upvotes: 0
Views: 153
Reputation: 52922
I solved it eventually by using an AsyncCallback object.
A centralised mail server solution would be ideal, but this project was a time critical proof of concept that had to be completed in just five days.
Upvotes: 0
Reputation:
Waiting for a background thread to get queued up on the CPU from within a request is going to be near pointless. You should probably queue your emails from all threads and service them from a separate process, or from within a dedicated thread spawned, say, within global.asax.
Upvotes: 1