asp.net导出Excel出错, 如何将ASP.NET添加到组或用户名中

RedskyDeng 2015-01-07 10:20:48
部署程序后在ASP中使用Excel出现如下问题:
‘----------------------------------------------------------------------
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)).
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.UnauthorizedAccessException: 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)).

ASP.NET is not authorized to access the requested resource. Consider granting access rights to the resource to the ASP.NET request identity. ASP.NET has a base process identity (typically {MACHINE}\ASPNET on IIS 5 or Network Service on IIS 6 and IIS 7, and the configured application pool identity on IIS 7.5) that is used if the application is not impersonating. If the application is impersonating via <identity impersonate="true"/>, the identity will be the anonymous user (typically IUSR_MACHINENAME) or the authenticated request user.

To grant ASP.NET access to a file, right-click the file in Explorer, choose "Properties" and select the Security tab. Click "Add" to add the appropriate user or group. Highlight the ASP.NET account, and check the boxes for the desired access.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
’-------------------
查了一下可能是权限设施问题,我以前设置过ASP.NET权限如下图,可以添加ASP.NET v4.0进去

但是这次不知道怎么添加不进去了,在“添加”中输入ASP.NET后提示找不到对象,

谁知道是什么问题,怎么把ASP.NET添加到组或用户名中并设置权限?
...全文
253 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
jmyz_0455 2015-01-08
  • 打赏
  • 举报
回复
我直接就是用管理员权限运行的,完美导出
yyz985 2015-01-08
  • 打赏
  • 举报
回复
涉及到本地文件和任务的,最好还是用管理员运行
SkyDeng 2015-01-07
  • 打赏
  • 举报
回复
引用 3 楼 RedskyDeng 的回复:
在DCOMCNFG中将标识更改为“启动用户“不会出现以上错误”但是提示有另外一个错误: 估计还是权限的问题,打开查看任务管理器EXCEL用不同设置启动的进程如下: 疑惑中。。。
不能使用“启动用户”,否则会有这个问题 必须使用“交互式”、
RedskyDeng 2015-01-07
  • 打赏
  • 举报
回复
引用 1 楼 zara 的回复:
不要直接输入,而是点击“高级”按钮,再点击“立即查找”按钮,看看列表里相关的用户名是什么,正确的话,点击之,若不对查下“查找位置”正确否。

我看了一下,查找位置只有一个选项,而且查找结果中没有ASP.NET是怎么回事。
zara 2015-01-07
  • 打赏
  • 举报
回复
不要直接输入,而是点击“高级”按钮,再点击“立即查找”按钮,看看列表里相关的用户名是什么,正确的话,点击之,若不对查下“查找位置”正确否。
RedskyDeng 2015-01-07
  • 打赏
  • 举报
回复
网上逛了一大圈,原来解决方法如下: -------------- 如何使用<identity impersonate="true"/>_ (2010-03-19 16:18:14)转载▼ 标签: it 前两天在VS2008下做个项目,用到了excel组件没有问题,但当把该项目在IIS下配置后,用浏览器浏览结果则不正确,网上说用dcom组件配置下,可是我按照要求配了,结果还是不对。 后来找到一个方法好用了。 Web.config中加了一句话:“<identity impersonate="true" userName="操作系统用户" password="用户密码"/>”,浏览…,结果正确,后来我就在网上查了下这句话的作用,MSDN是这样说的: 1、模拟 IIS 验证的帐户或用户 若要在收到 ASP.NET 应用程序中每个页的每个请求时模拟 Microsoft Internet 信息服务 (IIS) 身份验证用户,必须在此应用程序的 Web.config 文件中包含 <identity> 标记,并将 impersonate 属性设置为 true 2、为 ASP.NET 应用程序的所有请求模拟特定用户 若要为 ASP.NET 应用程序的所有页面上的所有请求模拟特定用户,可以在该应用程序的 Web.config 文件的 <identity> 标记中指定 userName 和 password 属性。例如: <identity impersonate="true" userName="accountname" password="password" />
RedskyDeng 2015-01-07
  • 打赏
  • 举报
回复
在DCOMCNFG中将标识更改为“启动用户“不会出现以上错误”但是提示有另外一个错误:

估计还是权限的问题,打开查看任务管理器EXCEL用不同设置启动的进程如下:

疑惑中。。。

18,124

社区成员

发帖
与我相关
我的任务
社区描述
Windows客户端使用相关问题交流社区
社区管理员
  • Windows客户端使用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧