打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
new Excel.ApplicationClass()报错:"Access is den...

在用Excel生成report时,报错,跟踪代码,错误是在

private void CreateExcel()
  {
   this._App = new Excel.ApplicationClass();   
   this._App.Visible = false;
   this._App.DisplayAlerts = false;
  }

红色字代码抛出异常:"Access is denied"

原因:服务器上Excel组件权限受到限制

解决:

方法1.在Component Services - Computers - My Computer - DCOM Config - Microsoft Excel应用程序 的Properties - Security页上:

Launch and Activation Permissions: 选择Customize, Edit, Add 相应的Group或者Users, 加了Everyone,各个Permissions选中

Configuration Permissions: 选择Customize, Edit, Add 相应的Group或者Users, 加了Everyone,各个Permissions选中

Everyone应该换为某个用户组,但是这部分我还不了解,先用Everyone代替。

方法2.在web.config中,在authentication tag下面加上:

<identity impersonate="true" userName="machinename\administrator" password="admin password" />

其中"machinename\administrator"是服务器管理员组中的某个用户

 

参考:http://www.webdeveloper.com/forum/archive/index.php/t-58132.html

本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
禁止双击盘符运行Autorun.inf文件
open failed: EACCES (Permission denied)
QC Export Wizard cannot continue at Step 5 of 8
Excel中如何输入根号?
Android动态权限详解
Win7系统打开EXCEL提示stdole32.tlb解决方法
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服