从ASP.NET应用程序访问Excel文件时出现问题 [英] Problem Accessing Excel File from ASP.NET Application

查看:112
本文介绍了从ASP.NET应用程序访问Excel文件时出现问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Windows Server 2008 R2。 ASP.NET 4.0,Excel 2013.我的问题是以编程方式打开并访问存储在服务器某处的一个Excel文件。尝试过DCOM和IIS权限设置。



确切错误:

检索具有CLSID的组件的COM类工厂{00024500-0000-0000- C000-000000000046}由于以下错误而失败:80070005拒绝访问。 (来自HRESULT的异常:0x80070005(E_ACCESSDENIED))。

Windows Server 2008 R2. ASP.NET 4.0, Excel 2013. My problem is to programmatically open and access one Excel file stored somewhere in the server. Tried DCOM and IIS permission settings.

Exact Error:
Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80070005 Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)).

推荐答案

检查以下答案。他们可能会帮助你。按照说明操作。



1. 检索组件的COM类工厂...错误:80070005访问被拒绝。(来自HRESULT的异常:0x80070005(E_ACCESSDENIED)) [ ^ ]

2. 检索组件的COM类工厂由于以下错误导致CLSID失败:拒绝访问80070005 [ ^ ]
Check the below answers. They might help you. Follow the instructions.

1. "Retrieving the COM class factory for component… error: 80070005 Access is denied." (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))[^]
2. Retrieving the COM class factory for component with CLSID failed due to the following error: 80070005 access is denied[^]


默认情况下,网站为用户分配了最小权限,仅用于运行网站本身。确保禁止实例化COM / DCOM对象。而且我不建议你更改用户权限......

无论如何你从一开始就认为我错了。 Microsoft提供 VSTO [ ^ ]包来处理代码中的office文件,即使没有安装Office!去学习它,而不是将其用于您的Web应用程序!
By default web site has a user assigned to it with minimal right, just for running the site itself. For sure instantiating COM/DCOM object is forbidden. And I do not advise you to change the users rights...
In any case you approach seems to me wrong from the beginning. Microsoft offers the VSTO[^] package to handle office files from code, even without Office installed! Go and learn it, than use it for your web application!


这篇关于从ASP.NET应用程序访问Excel文件时出现问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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