G
Guest
Hi all, sorry if this is an over simple question but google isn't
coming through for me.
So I have a class that processes the data in an excel file, entering
the info row by row into our database. The public interface is as such:
public class ExcelToQueueEngine
{
public ExcelToQueueEngine(string ConnectionString)
{
//constructor
_connStr = ConnectionString;
}
public void ProcessFile(string pathToExcelFile, int archiveId)
{
//do my row processing
}
}
This processing can take 5+ minutes, so i'd like to call the
ProcessFile method asynchronously, and let the web user go on their
merry way. I have extensive logging/tracing in the ProcessFile method,
so I dont need ( and especially don't want) to have to tie up the aspx
page that calls this method to worry about the IAsynchResult return. So
basically the process is started and the web page returns, and the
processing thread does all the excel work. My aspx code is:
ExcelToQueueEngine eng = new ExcelToQueueEngine(_connStr);
AsynchProcessDelegate del = new AsynchProcessDelegate(eng.ProcessFile);
del.BeginInvoke(filePath, archiveId, null, null);
It seems to be that the BeginInvoke is called, but then the processing
stops as the page returns to the user. Any ideas what I'm doing wrong?
Thanks in advance.
coming through for me.
So I have a class that processes the data in an excel file, entering
the info row by row into our database. The public interface is as such:
public class ExcelToQueueEngine
{
public ExcelToQueueEngine(string ConnectionString)
{
//constructor
_connStr = ConnectionString;
}
public void ProcessFile(string pathToExcelFile, int archiveId)
{
//do my row processing
}
}
This processing can take 5+ minutes, so i'd like to call the
ProcessFile method asynchronously, and let the web user go on their
merry way. I have extensive logging/tracing in the ProcessFile method,
so I dont need ( and especially don't want) to have to tie up the aspx
page that calls this method to worry about the IAsynchResult return. So
basically the process is started and the web page returns, and the
processing thread does all the excel work. My aspx code is:
ExcelToQueueEngine eng = new ExcelToQueueEngine(_connStr);
AsynchProcessDelegate del = new AsynchProcessDelegate(eng.ProcessFile);
del.BeginInvoke(filePath, archiveId, null, null);
It seems to be that the BeginInvoke is called, but then the processing
stops as the page returns to the user. Any ideas what I'm doing wrong?
Thanks in advance.