I have an ASP.NET web application to export an Excel file with multiple sheets. Each sheet contains multiple tables on it created using Microsoft.Excel.Interop.Services package. The export functionality works while the web application is hosted on my machine without any issue/error.
After hosting it in on the server machine via IIS, and accessing this web application through a client machine (via the application URL), while exporting the file, I get COM & interop related exceptions as seen in the screenshot.
To resolve this I used some changes in DCOM settings like : Component services > Computers > My Computer > Dcom Config > Right click on Microsoft Excel Application >Properties > Navigate to Identity and change the selection from 'The launching user' to 'Interactive user'. So after changing this setting I have tried again to export a file and this works fine without providing me the COM and interop exceptions. However, this only works if a user is logged into the server on which the web application is hosted on. If no user is logged into the server, I get the exceptions again as shown in below image.
Screenshot #1 is my Excel format, screenshot #2 is the COM and interop exception I'm getting, screenshot #3 is DCOM config settings:
