简体   繁体   中英

The remote procedure call failed Excel inside IIS

When I try to download an Excel file using asp.net I get this Error

The remote procedure call failed. (Exception from HRESULT: 0x800706BE) Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Runtime.InteropServices.COMException: The remote procedure call failed. (Exception from HRESULT: 0x800706BE)

Source Error:

 xlworkbook.SaveAs(Path) xlworkbook.Close() xlAPP.Quit() 'error on this line

[COMException (0x800706be): The remote procedure call failed. (Exception from HRESULT: 0x800706BE)]
Microsoft.Office.Interop.Excel.ApplicationClass.Quit() +0

and sometimes the error is

The remote procedure call failed. (Exception from HRESULT: 0x800706BE) Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Runtime.InteropServices.COMException: The remote procedure call failed. (Exception from HRESULT: 0x800706BE)

Source Error:

 xlworkbook.SaveAs(Path) xlworkbook.Close() 'line triggering the error xlAPP.Quit()

[COMException (0x800706be): The remote procedure call failed. (Exception from HRESULT: 0x800706BE)]

 Microsoft.Office.Interop.Excel._Workbook.Close(Object SaveChanges, Object Filename, Object RouteWorkbook) +0

I DID ALL The Below Steps

  1. Open Windows Explorer

  2. Depending on whether you installed a 32bit or 64bit version of office you will need to do one (or both) of the following: 32bit Office installation: Navigate to C:\\Windows\\System32\\config\\systemprofile 64bit Office installation:

  3. Navigate to C:\\Windows\\SysWOW64\\config\\systemprofile

  4. Verify the folder "Desktop" exists (create it if it's not there)

  5. Right click > Properties

  6. On the security tab: Add the account under which the site is running (eg: Network Service) with default permissions (Read & execute; List folder contents; Read)

In the dcomconfig utility,

go to Component Services --> Computers --> My Computer --> DCom Config --> Microsoft Excel Application (and Powerpoint)

Right click it and go to properties. Go to security tab. Under Security

1, Launch & Activation Permissions --> Choose customise and click Edit. Add User Network Service and check everything under Allow for it.

  1. Do the same for Access Permissions and Configuration Permissions.

Then click Apply and close everything.

Sometimes I can download the file but sometimes I got this error Any ideas why?

I did method 4 and it worked for me: https://support.microsoft.com/en-gb/kb/2758592

Method 4: Investigate possible issues with COM add-ins

Many developers create add-ins for Excel. These add-ins are divided into two types: Excel add-ins that are saved as .xla, .xlam, or .xll files. COM add-ins. These add-ins usually have to be installed and include DLLs and registry keys. COM add-ins created for one version of Excel frequently are not compatible with a newer version, and may cause crashes. They are not disabled by Safe mode, and should be investigated separately.

To disable COM add-ins, follow these steps: Select File > Options > Add-ins. At the bottom of the dialog box, change the Manage dropdown to COM add-ins, and select Go. Clear the checkbox for any enabled COM add-ins. select OK. If disabling the COM add-ins alleviates the issue, try enabling them one at a time to test for the problem add-in.If these steps do not resolve your issue, continue to method 5.

I did all these five steps and finally selected Interactive user in Identity Tab. its worked!!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM