How to fix 'Microsoft Excel cannot open or sav

2019-01-22 13:36发布

问题:

I am running C# ASP.NET 4.5 web application on Windows 7 64-bit using IIS 7.5. The application pool it uses has the name 'ASP.NET v4.0' and its identity is ApplicationPoolIdentity. The application uses MS Office Interop (Microsoft Excel 14.0 Object Library).

At line wBook = wBooks.Add(Missing.Value);, it throws the following error:

Microsoft Excel cannot open or save any more documents because there is not enough available memory or disk space.

u2022 To make more memory available, close workbooks or programs you no longer need.

u2022 To free disk space, delete files you no longer need from the disk you are saving to.: at Microsoft.Office.Interop.Excel.Workbooks.Add(Object Template)

1) I gave the account IIS apppool\ASP.NET v4.0 full control on MS Excel Application in DCOM Config.

2) I gave IIS apppool\ASP.NET v4.0 full control on 'C:\Windows\SysWOW64\config\systemprofile' and created a Desktop folder in it.

3) I need to continue using Interop though it's not recommended.

4) The application works fine on Windows Server 2003/Windows XP 32-bit.

5) MS Office 2010 (64-bit, trial version) is installed on the machine.

6) I would prefer not to change the app. pool identity from ApplicationPoolIdentity to Network Service etc.. ApplicationPoolIdentity is the new type of Identity in IIS 7 and it's recommended.

It works fine if I select 'Interactive User' (I have logged in as an admin) in DCOM Config, but it causes other problems. I need to use 'Launching User' which is ASP.NET v4.0. So it looks like it's a permission issue.

Please help. Thank you.

回答1:

Right click on the file with file explorer, choose Properties, then General tab and click on the Unblock button. This error message is very misleading.



回答2:

Go to this key on Registry Editor (Run | Regedit) HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders

change key Cache to something like C:\Windows\Temp

My similar problem was solved like this.

Regards,

Ripley



回答3:

I had this same issue, there was no issue regarding memory in my server machine, Finally i was able to fix it by following steps

  1. In your application hosting server, go to its "Component Services"

3.Find "Microsoft Excel Application" in right side.

4.Open its properties by right click

5.Under Identity tab select the option interactive user and click Ok button.

Check once again. Hope it helps

NOTE: But now you may end up with another COM error "Retrieving the COM class factory for component...". In that case Just set the Identity to this User and enter the username and password of a user who has sufficient rights. In my case I entered a user of power user group.



回答4:

Test like this.Sometimes, permission problem.

cmd => dcomcnfg

Click

Component services >Computes >My Computer>Dcom config> and select micro soft Excel Application

Right Click on microsoft Excel Application

Properties>Give Asp.net Permissions

Select Identity table >Select interactive user >select ok