Bill Herde
asked on
IIS app unable to open an excel file after write
On our process controller servers we have come across an interesting issue since the server was upgraded to server 2019. An IIS based web app on the host is instructed to upload a file from the user's local disk, then open it in Excel on the host where it will be parsed into a waiting database. The same code is working well on several other machines that are running server 2008. On the 2019 host the file uploads, and successfully writes it to the temp directory. Excel is invoked, but it fails to find the file and open it. A rather generic windows type error is passed back to the app.
"An unexpected error occurred: Microsoft Excel cannot access the file 'C:\Temp\Test SP_WCETest1_001_Test Meter_20200218040939.AMD.x lsx'. There are several possible reasons: • The file name or path does not exist. • The file is being used by another program. • The workbook you are trying to save has the same name as a currently open workbook."
I have verified the permissions on the file and the folder are open to group 'everyone' with full control. From the host console the file will open in excel with a double-click. There are no errors in the event logs beyond the one passed back to IIS. (above)
I pulled up procmon on a working host and compared file activity to the temp directory between the working and non-working. csv files are attached. Ike is the working 2008 server, Phillip is the failing 2019 server. The only thing that I found of interest is on Phillip, there is some svchost and finally some system activity in the directory well after the failure has been displayed on the app screen. (which happens while Excel is active)
I disabled disk cache on the system as well as anything that looks like antivirus. All are VMs running on vSphere 6.5 and are fully patched.
Got ideas?
Ike_Logfile.CSV
Phillip_Logfile.CSV
"An unexpected error occurred: Microsoft Excel cannot access the file 'C:\Temp\Test SP_WCETest1_001_Test Meter_20200218040939.AMD.x
I have verified the permissions on the file and the folder are open to group 'everyone' with full control. From the host console the file will open in excel with a double-click. There are no errors in the event logs beyond the one passed back to IIS. (above)
I pulled up procmon on a working host and compared file activity to the temp directory between the working and non-working. csv files are attached. Ike is the working 2008 server, Phillip is the failing 2019 server. The only thing that I found of interest is on Phillip, there is some svchost and finally some system activity in the directory well after the failure has been displayed on the app screen. (which happens while Excel is active)
I disabled disk cache on the system as well as anything that looks like antivirus. All are VMs running on vSphere 6.5 and are fully patched.
Got ideas?
Ike_Logfile.CSV
Phillip_Logfile.CSV
ASKER
Ajay Thanks for the response. I granted the permissions as suggested, but there is no change. I had already granted full access to 'everyone' for troubleshooting, and as such I think it is less likely to be a permissions issue. Still seeking suggestions.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Correct the comment please. For some reason it will not let me edit.
Found a writeup here that had part of the solution.
https://stackoverflow.com/questions/17530797/cannot-open-excel-file-in-c-sharp
Had to create folder C:\Windows\System32\config \systempro file\Deskt op and grant permissions to that folder for everyone to modify. This folder is supposed to disappear when upgrading to server 2008, but this machine was originally built as 2008, so I don't know why it ever worked before if that was required. This changed the error to an even more generic "An unexpected error occurred: Exception from HRESULT: 0x800A03EC" which is a basic "Excel fell down and nobody knows why" message.
Then I changed the DCOM config properties for Excel to run as 'interactive user' instead of 'launching user', and we are back in business.
https://support.activepdf.com/hc/en-us/articles/115004959093-DCOM-Permissions-for-Microsoft-Office
Found a writeup here that had part of the solution.
https://stackoverflow.com/questions/17530797/cannot-open-excel-file-in-c-sharp
Had to create folder C:\Windows\System32\config
Then I changed the DCOM config properties for Excel to run as 'interactive user' instead of 'launching user', and we are back in business.
https://support.activepdf.com/hc/en-us/articles/115004959093-DCOM-Permissions-for-Microsoft-Office
Try granting the application pool account full permission on temp or change it to local system (less recommended).