By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,364 Members | 1,536 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,364 IT Pros & Developers. It's quick & easy.

aspx page to kick off async background task and then end

P: n/a
I'm not sure of the best way to do what I want. Users of my website want to
run reports that take a long time to generate. This is what I would like to
happen:

1. User requests aspx page
2. aspx page kicks off an asynchronous background task (on the same web
server) to generate the report. The end result will be a file created on
the website.
3. aspx page returns this message to the user: "your report is being
generated, check back in a few minutes"
4. aspx page ends.
5. (optional, the icing on the cake) A frame in the user's frameset starts
(through client-side script) sending periodic requests to the server to
check whether the report is ready, and displays a message box to inform the
user when they can pick it up.
6. User goes to their "My Reports" page and collects the report
7. After 24 hours the report file is automatically deleted from the server

Now, my question is how to do step 2. I guess it could be done with MSMQ,
but is there a better way? I tried making a Windows service and making an
asynchronous call to it with Delegate.BeginInvoke(). However, it doesn't
seem suited to my situation because it seems to insist that the caller (the
aspx page) stays alive for the end result, whereas I want the caller to
terminate while the callee is still running. When my BeginInvoke() caller
terminates, the callee seems to stop also. Additionally, the documentation
says the caller must call EndInvoke(), which mine can't.

Am I on the right track, or should I be using MSMQ? Shelling? A web
service? Some kind of ThreadPool? So many technologies...

Thanks in advance,
Carl Johansen
http://www.carljohansen.co.uk


Nov 19 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
This seems a nice article I found on the subject :
http://www.codeproject.com/aspnet/as...ionhandler.asp

I found it after googling
http://www.google.com/search?hl=en&l...ng&btnG=Search

Let me know if you have any more questions..

Cheers,
Tom Pester
I'm not sure of the best way to do what I want. Users of my website
want to run reports that take a long time to generate. This is what I
would like to happen:

1. User requests aspx page
2. aspx page kicks off an asynchronous background task (on the same
web
server) to generate the report. The end result will be a file created
on
the website.
3. aspx page returns this message to the user: "your report is being
generated, check back in a few minutes"
4. aspx page ends.
5. (optional, the icing on the cake) A frame in the user's frameset
starts
(through client-side script) sending periodic requests to the server
to
check whether the report is ready, and displays a message box to
inform the
user when they can pick it up.
6. User goes to their "My Reports" page and collects the report
7. After 24 hours the report file is automatically deleted from the
server
Now, my question is how to do step 2. I guess it could be done with
MSMQ, but is there a better way? I tried making a Windows service and
making an asynchronous call to it with Delegate.BeginInvoke().
However, it doesn't seem suited to my situation because it seems to
insist that the caller (the aspx page) stays alive for the end result,
whereas I want the caller to terminate while the callee is still
running. When my BeginInvoke() caller terminates, the callee seems to
stop also. Additionally, the documentation says the caller must call
EndInvoke(), which mine can't.

Am I on the right track, or should I be using MSMQ? Shelling? A web
service? Some kind of ThreadPool? So many technologies...

Thanks in advance,
Carl Johansen
http://www.carljohansen.co.u

Nov 19 '05 #2

P: n/a
Carl,

I don't know much about MSMQ, but I can put my 2c in your Windows service
cashbox.

A Windows service seems to be an appropriate solution in your case. As you
write, all you need to do is to kick a task off. But you are doing it in a
complicated way. There is a much simpler way.

Every time when the user requests a report, make a text file with the
request parameters in a preset location. Equip the windows service with a
FileSystemWatcher object that will notify the service about new request
files. Just in case make the service to poll the request directory
periodically to pickup missed notifications.

When the service is done with a report, it can send a notification email to
the user. If you wish, you can attach the report to the email.

Eliyahu

"Carl Johansen" <carl@_NOSPAM_carljohansen.co.uk> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
I'm not sure of the best way to do what I want. Users of my website want to run reports that take a long time to generate. This is what I would like to happen:

1. User requests aspx page
2. aspx page kicks off an asynchronous background task (on the same web
server) to generate the report. The end result will be a file created on
the website.
3. aspx page returns this message to the user: "your report is being
generated, check back in a few minutes"
4. aspx page ends.
5. (optional, the icing on the cake) A frame in the user's frameset starts
(through client-side script) sending periodic requests to the server to
check whether the report is ready, and displays a message box to inform the user when they can pick it up.
6. User goes to their "My Reports" page and collects the report
7. After 24 hours the report file is automatically deleted from the server

Now, my question is how to do step 2. I guess it could be done with MSMQ,
but is there a better way? I tried making a Windows service and making an
asynchronous call to it with Delegate.BeginInvoke(). However, it doesn't
seem suited to my situation because it seems to insist that the caller (the aspx page) stays alive for the end result, whereas I want the caller to
terminate while the callee is still running. When my BeginInvoke() caller
terminates, the callee seems to stop also. Additionally, the documentation says the caller must call EndInvoke(), which mine can't.

Am I on the right track, or should I be using MSMQ? Shelling? A web
service? Some kind of ThreadPool? So many technologies...

Thanks in advance,
Carl Johansen
http://www.carljohansen.co.uk

Nov 19 '05 #3

P: n/a
Tom,

Thanks a lot; the article's idea of creating a custom thread is looking
promising.

Carl.
<To********************@pandora.be> wrote in message
news:a1**************************@news.microsoft.c om...
This seems a nice article I found on the subject :
http://www.codeproject.com/aspnet/as...ionhandler.asp

I found it after googling
http://www.google.com/search?hl=en&l...ng&btnG=Search

Let me know if you have any more questions..

Cheers,
Tom Pester
I'm not sure of the best way to do what I want. Users of my website
want to run reports that take a long time to generate. This is what I
would like to happen:

1. User requests aspx page
2. aspx page kicks off an asynchronous background task (on the same
web
server) to generate the report. The end result will be a file created
on
the website.
3. aspx page returns this message to the user: "your report is being
generated, check back in a few minutes"
4. aspx page ends.
5. (optional, the icing on the cake) A frame in the user's frameset
starts
(through client-side script) sending periodic requests to the server
to
check whether the report is ready, and displays a message box to
inform the
user when they can pick it up.
6. User goes to their "My Reports" page and collects the report
7. After 24 hours the report file is automatically deleted from the
server
Now, my question is how to do step 2. I guess it could be done with
MSMQ, but is there a better way? I tried making a Windows service and
making an asynchronous call to it with Delegate.BeginInvoke().
However, it doesn't seem suited to my situation because it seems to
insist that the caller (the aspx page) stays alive for the end result,
whereas I want the caller to terminate while the callee is still
running. When my BeginInvoke() caller terminates, the callee seems to
stop also. Additionally, the documentation says the caller must call
EndInvoke(), which mine can't.

Am I on the right track, or should I be using MSMQ? Shelling? A web
service? Some kind of ThreadPool? So many technologies...

Thanks in advance,
Carl Johansen
http://www.carljohansen.co.uk


Nov 19 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.