和Excel相关的代码如下: using Excel;                 
    Excel.Application excel = new Excel.Application();
    excel.Application.Workbooks.Add ( true ) ;
    excel.Visible = true ; 
编译完成后却出现以下的错误信息:拒绝访问。 
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. To grant ASP.NET write 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.哪位高手指点一下阿,

解决方案 »

  1.   

    权限问题:
    如果是Window2003 ->控制面版 -> 管理工具 -> 组件服务 -> 
         打开树级目录找到子目录DCOM配置 -> Microsoft Excel 应用程序 
         -> 右击选“属性” -> 在弹出对话窗口中选“安全”选项卡->
         -> 将启动和激活权限设为自定义->点击编辑按钮->
         ->在新窗口中将Everyone用户加入,选中复选框"启动权限",给予启动权限如果是WindowXP ->控制面版 -> 管理工具 -> 组件服务(繁体为"元件服务") -> 
         打开树级目录找到子目录DCOM配置 -> Microsoft Excel 应用程序 
         -> 右击选“属性” -> 在弹出对话窗口中选“安全”选项卡->
         -> 将启动和激活权限设为自定义->点击编辑按钮->
         ->在新窗口中将Everyone用户加入,选中复选框"远程启动",给予远程启动权限
    具体请看:
    http://blog.csdn.net/ChengKing/archive/2005/11/29/539514.aspx