try
{
var _with1 = xlWorkSheet;
_with1.Cells[1, 1] = "SCQA OVER TIME on - " + DateTime.Now.ToString("dd/MMM/yyyy");
}
catch (Exception ex) { }
Any reason why you have this in production code???
If something does not work, you need to start debugging. Visual Studio has a remote debugging feature. you can even set breakpoints and step through the code. Read more here:
Remote debugging in Visual Studio | Microsoft Docs[
^]
Also, have you considered that Excel may not be installed on your web server?
UPDATE
Running excel on a web server may be very problematic even if you can resolve your issue. Typically, web servers can have single, tens, hundreds, thousands, etc of simultaneous connections. The excel client is not designed with this purpose in mind. You would be better off:
1. finding a third-party paid or free library that can work with excel files;
2. simply generate CSV files that can be downloaded and imported into Excel;
3. use an Office 365 API and use it to generate your files. Office 365 is designed to handle these types of workloads.