IIS中的远程过程调用失败Excel [英] The remote procedure call failed Excel inside IIS
问题描述
当我尝试使用asp.net下载Excel文件时,出现此错误
When I try to download an Excel file using asp.net I get this Error
远程过程调用失败. (来自HRESULT的异常:0x800706BE) 说明:在执行期间发生未处理的异常 当前的Web请求.请查看堆栈跟踪以获取更多信息 有关错误及其在代码中起源的信息.
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.
异常详细信息:System.Runtime.InteropServices.COMException: 远程过程调用失败. (来自HRESULT的异常:0x800706BE)
Exception Details: System.Runtime.InteropServices.COMException: The remote procedure call failed. (Exception from HRESULT: 0x800706BE)
源错误:
xlworkbook.SaveAs(Path)
xlworkbook.Close()
xlAPP.Quit() 'error on this line
[COMException(0x800706be):远程过程调用失败.
(来自HRESULT的异常:0x800706BE)]
Microsoft.Office.Interop.Excel.ApplicationClass.Quit()+0
[COMException (0x800706be): The remote procedure call failed.
(Exception from HRESULT: 0x800706BE)]
Microsoft.Office.Interop.Excel.ApplicationClass.Quit() +0
有时错误是
远程过程调用失败. (来自HRESULT的异常:0x800706BE) 说明:在执行期间发生未处理的异常 当前的Web请求.请查看堆栈跟踪以获取更多信息 有关错误及其在代码中起源的信息.
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.
异常详细信息:System.Runtime.InteropServices.COMException: 远程过程调用失败. (来自HRESULT的异常:0x800706BE)
Exception Details: System.Runtime.InteropServices.COMException: The remote procedure call failed. (Exception from HRESULT: 0x800706BE)
源错误:
xlworkbook.SaveAs(Path)
xlworkbook.Close() 'line triggering the error
xlAPP.Quit()
[COMException(0x800706be):远程过程调用失败. (来自HRESULT的异常:0x800706BE)]
[COMException (0x800706be): The remote procedure call failed. (Exception from HRESULT: 0x800706BE)]
Microsoft.Office.Interop.Excel._Workbook.Close(Object SaveChanges, Object Filename, Object RouteWorkbook) +0
我按照以下步骤进行了所有操作
-
打开Windows资源管理器
Open Windows Explorer
取决于您安装的是32位还是64位版本的 办公室,您将需要执行以下一项(或两项):32bit Office安装:导航到 C:\ Windows \ System32 \ config \ systemprofile 64位Office安装:
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:
导航到C:\ Windows \ SysWOW64 \ config \ systemprofile
Navigate to C:\Windows\SysWOW64\config\systemprofile
验证文件夹"Desktop"是否存在(如果不存在,请创建该文件夹)
Verify the folder "Desktop" exists (create it if it's not there)
右键单击>属性
在安全性"选项卡上:添加用于运行网站的帐户 (例如:网络服务)具有默认权限(读取和执行;列表) 文件夹内容;阅读)
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)
在dcomconfig实用程序中,
In the dcomconfig utility,
转到组件服务->计算机->我的电脑-> DCom配置-> Microsoft Excel应用程序(和Powerpoint)
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,启动&激活权限->选择自定义,然后单击编辑.添加用户网络服务并检查允许"下的所有内容.
1, Launch & Activation Permissions --> Choose customise and click Edit. Add User Network Service and check everything under Allow for it.
- 对访问权限和配置权限执行相同的操作.
然后单击应用"并关闭所有内容.
Then click Apply and close everything.
有时我可以下载文件,但有时会出现此错误 有什么想法吗?
Sometimes I can download the file but sometimes I got this error Any ideas why?
推荐答案
我做了方法4,它对我有用: https://support.microsoft.com/en-gb/kb/2758592
I did method 4 and it worked for me: https://support.microsoft.com/en-gb/kb/2758592
方法4:研究COM加载项可能存在的问题
Method 4: Investigate possible issues with COM add-ins
许多开发人员为Excel创建加载项.这些加载项分为两种类型: 保存为.xla,.xlam或.xll文件的Excel加载项. COM加载项.这些加载项通常必须安装,并包括DLL和注册表项.为一个版本的Excel创建的COM加载项经常与较新版本不兼容,并可能导致崩溃.它们不会被安全模式禁用,应该单独进行调查.
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.
要禁用COM加载项,请按照下列步骤操作: 选择文件>选项>加载项. 在对话框的底部,将管理"下拉列表更改为COM加载项,然后选择执行". 清除所有启用的COM加载项的复选框.选择确定. 如果禁用COM加载项可以缓解此问题,请尝试一次启用一个以测试问题加载项.如果这些步骤不能解决您的问题,请继续执行方法5.
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.
这篇关于IIS中的远程过程调用失败Excel的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!