一个操作Excel的问题

cbw99 2004-09-09 10:27:03
在运行“Application app = new Application();”这句话的时候程序总是报错说拒绝访问,说ASP.NET没有访问该资源的权限,请问这是怎么回事?该怎么解决?

错误信息如下:
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: 拒绝访问。
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) 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.
...全文
229 16 打赏 收藏 转发到动态 举报
写回复
用AI写文章
16 条回复
切换为时间正序
请发表友善的回复…
发表回复
cbw99 2004-09-10
  • 打赏
  • 举报
回复
CSDN 结贴有问题,给分的时候操作失败,但帖子状态却被设置为已结贴!!!
cool_liucs 2004-09-10
  • 打赏
  • 举报
回复
你得先配置一下Dcom
出现asp_net用户操作Excel的权限不够,配置Dcom。运行Dcomcnfg.exe,找到Excel应用程序,配置其属性,身份验证级别选“无”,身份标识选“交互式用户”,安全性页面,启动和访问均给everyone。注意:查看当前进程中是否有Winword进程存在,如果有且不能被结束,那么重启动计算机。再次运行你的代码即OK。这样以后就不会出现权限不够的情况了
cbw99 2004-09-10
  • 打赏
  • 举报
回复
以解决,<identity impersonate="true" />就行了
cbw99 2004-09-10
  • 打赏
  • 举报
回复
在Windows application里就没问题,在Web application里就拒绝访问,真奇怪!!!
sueprljy 2004-09-09
  • 打赏
  • 举报
回复
计算机管理里面...->默认网站->你的项目 右键->属性里看看有无写入的权限
cbw99 2004-09-09
  • 打赏
  • 举报
回复
asp.net一直都在administrators组里 :-(
sueprljy 2004-09-09
  • 打赏
  • 举报
回复
Eddie005(暴走005) 的方法你再试试
cbw99 2004-09-09
  • 打赏
  • 举报
回复
sueprljy(懂你很难),刚刚试了你的方法,很可惜,还是不行
sueprljy 2004-09-09
  • 打赏
  • 举报
回复
win2000在属性里有一个标签卡,可以设置,关键要找到"写入"
khpcg 2004-09-09
  • 打赏
  • 举报
回复
源程序
cbw99 2004-09-09
  • 打赏
  • 举报
回复
win2000 professional
sueprljy 2004-09-09
  • 打赏
  • 举报
回复
C:/Inetpub/wwwroot/你的项目 右键->属性->Web共享->共享文件夹->访问权限->把"写入"打钩!->确定
sueprljy 2004-09-09
  • 打赏
  • 举报
回复
你的系统是xp吧?
cbw99 2004-09-09
  • 打赏
  • 举报
回复
添加过了,还是不行
Eddie005 2004-09-09
  • 打赏
  • 举报
回复
asp.net用户没有操作excel的权限,
把aspnet用户添加到administrator组试试
cbw99 2004-09-09
  • 打赏
  • 举报
回复
有写入权限,还是不行

110,537

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

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