Free Support Forum - aspose.com

Multithreading excel requests

Good Day,<br>I am developing a multithreading windows application in C# in which every thread does a web request and expect a result. Each request reads some cells from an existing excel file and then creates new workbook and fiil the excel spreadsheet with some data.Based on excel calculation I get the result.<br><br>The problem I have is that even if seeing the log messages all requests seems to work well (the result appears on the logs) , I get some time out responses .<br>For example : for 20 threads ,8 of them gets time out even if in their logs the result is retrieved. <br>This happens not all times but in most of the cases.<br><br>Thank you !<br>
Hi,

Thanks for considering Aspose.

Could you give us some details if the problem happens on Workbook.Open method line. And Could you try to lock the template file in every thread code to avoid concurrently opening and check if it works fine.

E.g.,

//Open template
workbook = new Workbook();
//Creating a file stream containing the Excel file to be opened
FileInfo f = new FileInfo(TemplatePath);
lock (f)
{
fstream = new FileStream(TemplatePath, FileMode.Open, FileAccess.Read, FileShare.Read);
workbook.Open(fstream);
}
.
.
.

Thank you.