Click here to Skip to main content
15,890,186 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
SO. I am developing an application where I need to make long run Actions which proven to take more than 30k ms per request as I tested it. It does some API Calls to third party servers and return data in Json and Image formats.
Throughout searching SO questions and many other blog posts regarding the issue I have found out to have only two options.
1st. To make the Action return a partial view and render it on the main view showing some fancy loading gifs until the action progress is completed.
2nd. Have to write API Controllers and do the background work there.

What is the best choice between these two solutions and is there any other technique that I missed and deal with the situation better?
Thanks

What I have tried:

I am just reading blogs about Web APIs and related things
Posted
Updated 16-Feb-17 4:59am

You could try using a BackgroundWorker thread to execute the long running process and use ReportProgress to send progress back to your main thread. The Background thread will send a callback when it's completed. Your main thread would then be primarily responsible for running "fancy loading gifs" and the GUI.
 
Share this answer
 
Any solution you implement that uses IIS is going to be at the mercy of IIS shutting down your app if it uses too much memory etc. You could farm the work off to a Windows Service, maybe using MSMQ to send the requests to the service, with the service doing all the actual work, and providing a mechanism where the front end can be informed of progress.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900