Tech
Forums
Jobs
Books
Events
Videos
Live
More
Interviews
Certification
Training
Career
Members
News
Blogs
Contribute
An Article
A Blog
A Video
An Ebook
An Interview Question
Register
Login
0
Answer
Invoking excel object using threading from web services
Vamsi Garuda
14y
3.5k
1
Reply
Guys
I was trying to invoke a back ground process (mutli threaded env) from asp.net webservice in which excel object is used to calculate basing on define excel formula's. below is the code...
public
void
SubmitBatchForPayrollProcessing(
Int32
batchId)
{
//Spawn different thread and then return .....To have the tax processing done in background
this
.batchId = batchId;
ThreadPool
.QueueUserWorkItem(
new
WaitCallback
(ProcessPayrollForBatch));
}
In turn ProcessPayrollForBatch
function invokes excel object
this
.exelProcessor =
new
ExcelProcessor
();
I'm getting below error
An unhandled exception occurred and the process was terminated.
Application ID: /LM/W3SVC/1/Root/PayrollService
Process ID: 2448
Exception: System.Runtime.InteropServices.COMException
Message: Microsoft Office Excel cannot open or save any more documents because there is not enough available memory or disk space.
• To make more memory available, close workbooks or programs you no longer need.
• To free disk space, delete files you no longer need from the disk you are saving to.
StackTrace: at Microsoft.Office.Interop.Excel.Workbooks.Add(Object Template)
at JFA.IndiePay.BusinessAccess.ExcelProcessor..ctor() in C:\JFAFilms\Vertex\VertaxTest\BusinessAccess\ExcelProcessor.cs:line 23
at PayrollService.PayrollService.ProcessPayrollForBatch(Object param) in C:\JFAFilms\Vertex\VertaxTest\PayrollService\PayrollService.asmx.cs:line 124
at System.Threading._ThreadPoolWaitCallback.WaitCallback_Context(Object state)
at System.Threading.ExecutionContext.runTryCode(Object userData)
at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading._ThreadPoolWaitCallback.PerformWaitCallbackInternal(_ThreadPoolWaitCallback tpWaitCallBack)
at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback(Object state)
For more information, see Help and Support Center at
http://go.microsoft.com/fwlink/events.asp
.
---------------------
If I invoke excel object in a single thread env it was running as expected, but if I multi thread env I was getting above error.
Can any one help on this ?
Regards
MOhan
Post
Reset
Cancel
Answers (
0
)
Next Recommended Forum
CSS file is not working, May be it's redirecting by external sitelink, how to fix it
Viewstate