Last post Jul 14, 2014 04:24 AM by Fuxiang Zhang - MSFT
Jul 10, 2014 02:19 PM|Jerry8989|LINK
I have a web site that allows users to select data. If the user selects a big job I would like to start the job then redirect the user to another page that tells them an email will be sent when the job is finished.
How can I leave the job running and redirect the user at the same time? Once the job does finish I need to run an error check on the log file that is generated and if there are errors send that in the email to the user.
If the user has a small job I want the job to run with the user on the page and have it redirect after the job is completed.
Here is my current code where it is an synchronous process
Process p = new Process();
p.StartInfo.Arguments = " -config 'C:\\temp\\Web.cfg'" ;
p.StartInfo.CreateNoWindow = true;
p.StartInfo.FileName = "sas.exe";
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.UseShellExecute = false;
catch (Exception ex)
errDesc = clsUtil.CheckErrors("test.log", "ERROR");
Jul 11, 2014 09:24 AM|Perkinsville|LINK
You might consider having the web page simply write some data into a database table, then have a service like process running every so often to check for rows in the table. If found, it will execute the logic you want run asynchronously.
For example: Use WebJobs to run background tasks in Microsoft Azure Web Sites:
Cool thing to look into is Web Sockets, so you maintain a connection to the client and you can send them a signal when the process is complete.
Jul 11, 2014 09:39 AM|Jerry8989|LINK
Thank you so much for your reply.
What would be the best path for a public website with many users running jobs simultaneously? Some of those jobs can be big and some small. The website is ASP.NET c# .net 4.5 running on IIS 7.5 on windows server 2008R2. I was looking into just creating
a thread in my code behind to run the job process and then redirect the user but that is locking up.
I've never used with windows azure and due to my time crunch I don't have time to study it. What can I create to run on the server to check every minute for a new entry in a database table? If its a service do you have a basic tutorial to explain it?
Thank you again so much,
Jul 14, 2014 04:24 AM|Fuxiang Zhang - MSFT|LINK
What can I create to run on the server to check every minute for a new entry in a database table? If its a service do you have a basic tutorial to explain it?
From your description, I see you want a application or windows service to handle the large task of your website.
If you do not want to use windows azure web job, I think you can create a background windows service or scheduled task to handle web application tasks.
There is an article for "Use a Windows Service just to run a scheduled process", you can refer to below.
And there are many similar issues collected below.
Hope it helps, thanks.