RPC_E_SERVERFAULT错误在asp.net上的一个Excel文件 [英] RPC_E_SERVERFAULT error on oppening an Excel file in asp.net

查看:340
本文介绍了RPC_E_SERVERFAULT错误在asp.net上的一个Excel文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试打开一个Excel文件来获取和设置一些值。不幸的是,我别无选择,我必须使用Excel。

I'm trying to open an Excel file to get and set some values. Unfortunately, I have no choice, I must to work with Excel.

Dim xAp As New Microsoft.Office.Interop.Excel.Application
Dim xWkb As Microsoft.Office.Interop.Excel.Workbook

xWkb = xAp.Workbooks.Open("c:\uploads\teste.xls")

总是有这个例外:(HRESULT异常:0x80010105(RPC_E_SERVERFAULT))

需要我的Excel安装在服务器机器中才能打开Excel文件?我不这么认为,因为当我创建一个新的应用程序和工作簿通过代码,所有的事情都是正确的,但...它的一个可能性...

Need I Excel installed in server machine to open Excel files? I don't think so, because when I create a new application and workbook throught code, all things go right, but... its a possibility...

谢谢帮助。

推荐答案

是的,您需要在服务器上安装Excel才能使用COM Interop打开Excel文件。不推荐,建议您使用第三方库访问Excel文件中的数据。您也可以尝试将数据放在使用CSV的更简单的工作中,尽管您表示可能无法实现。

Yes, you need Excel installed on the server to open Excel files using COM Interop. It's not recommended, and I would recommend using a 3rd party library to access data in Excel files. You can also try and put the data into an easier-to-work with CSV, though you stated this might not be possible.

这篇关于RPC_E_SERVERFAULT错误在asp.net上的一个Excel文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆