I have a Windows Server 2019. And I have a website hosted there on IIS. On the website, there's a button that fetches information from a database (sql server), and then creates an Excel worksheet with that information. Once it is done, it opens the Excel file to the user, so that he can save it, or whatever.
Simple VB code using Microsoft.Office.Interop.Excel to create the application.
(Only showing relevant code)
Dim appXL As Excel.Application
Dim wbXl As Excel.Workbook
Dim shXL As Excel.Worksheet
Dim raXL As Excel.Range
appXL = CreateObject("Excel.Application")
wbXl = appXL.Workbooks.Add
shXL = wbXl.ActiveSheet
appXL.Visible = True
appXL.UserControl = True
Now, testing this locally has no issue whatsoever. I click the button, and it generates the Excel file, and opens it. However, when I bring the site onto my Windows Server2019, it has issues.
- At first, Microsoft Office wasn't installed, so I was getting ActiveX problems. That was solved by installing Office, thus Excel.
- After, I had to go in the Service Components, into the DCOM configs to enable the NETWORK SERVICE user to access the Excel Application (following this link).
The problem I have now, is that clicking the button will go through the steps of fetching the database info, and building the entire Excel file in the backend. This is shown by the fact that the Excel process in the Task Manager is running when I click the button. However, this entry in the Task Manager is in the Background processes, rather than Applications.
The site doesn't display any errors, it simply rolls through the code, and just never shows the Excel file. It's not in the taskbar, or anything. I tried some things to show it, such as:
appXL.Windows(wbXL.Name).visible = true
doesn't work- Maximizing the Window
So far, no shot. It works fine on my station obviously, Excel opens, but it doesn't on the Server. I'm wondering if it has something to do with certain rights that I haven't configured? I did just install Microsoft Office on the server this morning. Maybe there's something else to do?
Thank you very much.