IIS无法为用户获得对Excel文件的访问,但是对我来说是可以的.为什么? [英] IIS Cannot Get Access to an Excel File for Users, But is OK for Me. Why?

查看:409
本文介绍了IIS无法为用户获得对Excel文件的访问,但是对我来说是可以的.为什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Windows Server 2008 R2的IIS中有一个作为服务运行的程序.该程序在Excel中创建报表没有问题.当它尝试访问刚刚创建的Excel时,就会发生此问题.在此代码行处,这给用户带来了80070005错误:

I have a program running as a service in IIS in Windows Server 2008 R2. The program has no problem creating a report in Excel. The problem occurs when it tries to get access to the Excel the that it has just created. This gives the users a 80070005 error right at this line of code:

Excel.Application excelSS = null;
excelSS = new Excel.Application(); <-- Error

因为到那时,该程序尚未尝试访问Excel文件,所以我认为问题与缺少对该文件的访问权限无关.我相信问题可能与定位Excel程序有关.这可能与以下事实有关:Excel是32位,而Windows操作系统是64位.我不确定.

Because at that point, the program has not tried to get access to the Excel file just yet, I believe the problem is not related to lack of access rights to the file. I believe the problem may have to do with locating the Excel program. This may have to do with the fact that the Excel is 32-bit and the Windows operating system is in 64-bit. I am not sure.

奇怪的是,我通过IIS查看Excel报表没有问题.另一个IT人士也没有问题.但是普通用户在尝试做完全相同的事情时都会遇到这个问题.所有这些都表明该问题与访问权限"有关的可能性很高.如果它与Excel的设置有关,则我认为包括我在内的每个人都会遇到相同的问题.这很令人困惑.

The strange thing is that I have no problem viewing the Excel report through IIS. Another IT guy also has no problem doing this. But normal users all have this problem trying to do the exact same thing. This all points to the high probability that this problem is related to "access rights". If it has to do with the setup of Excel, I would assume that everyone including me would have the same problem. This is very puzzling.

我已经尝试了可以​​在Internet上找到的所有提示:

I have already tried all the tips that I can find in Internet:

  • 确认IIS中的应用程序池使用IIS APPPOOL \ DefaultAppPool用户帐户.

  • Confirm that the Application-Pools in IIS uses IIS APPPOOL\DefaultAppPool user account.

在system32和SysWOW64中的config \ systemprofile下添加一个桌面"文件夹,并确保IIS APPPOOL \ DefaultAppPool用户帐户对这些文件夹具有读/写访问权限.

Add a "Desktop" folder in system32 and in SysWOW64 under config\systemprofile and make sure the IIS APPPOOL\DefaultAppPool user account has read/write access to those folders.

运行DCOM-Config,并在COM-Security下将本地访问/启动/激活权限分配给IIS APPPOOL \ DefaultAppPool.并确保32位和64位DCOM-Config都获得了这些设置.

Run DCOM-Config, and assign local access/launch/activation rights to IIS APPPOOL\DefaultAppPool under COM-Security. And make sure both 32-bit and 64-bit DCOM-Config get these settings.

由于用户使用"Windows身份验证"在IIS中运行该程序,因此我还要确保用户可以使用自己的用户帐户来访问IIS服务器中存储该文件夹的文件夹. Excel文件.

Because of the fact that the users use "Windows Authentication" to run the program in IIS, I also make sure that the users can use their own user account to get access to the folder in IIS server that stores the Excel file.

我什至可以将IIS APPPOOL \ DefaultAppPool添加到本地管理员用户组.

I even go as far as adding IIS APPPOOL\DefaultAppPool to local admin user group.

我无法尝试的唯一提示是,我找不到DCOM-Config程序(组件服务->计算机->我的电脑-> DCom Config)中列出的"Microsoft Excel应用程序".我应该在该列表中将对IIS APPPOOL \ DefaultAppPool的启动/激活访问权限添加到"Microsoft Excel Application"中.但是以某种方式"Microsoft Excel应用程序"不在列表中.我尝试在System32和SysWOW64文件夹的DCOM-Config中寻找它.这种似乎"就像问题出在哪里.但由于我使用用户帐户查看Excel报表没有问题,因此我对此不确定.如果Excel中的设置有问题,我认为我们谁都无法查看Excel报告.

The only tip that I cannot try is the fact that I cannot find "Microsoft Excel Application" listed in DCOM-Config program (Component Services --> Computers --> My Computer --> DCom Config). I am supposed to add launch/activate access rights to IIS APPPOOL\DefaultAppPool to "Microsoft Excel Application" in that list. But somehow "Microsoft Excel Application" is not in the list. I have tried looking for it in DCOM-Config in both System32 and SysWOW64 folders. This "seems" like where the problem is. But I am not sure about this because of the fact that I have no problem viewing the Excel report using my user account. If there was something wrong with the settings in Excel, I would think that none of us could view the Excel report.

当我在Windows Server 2003 R2-32位或Windows XP 32位中安装该程序时,我没有遇到这个问题.

I didn't have this problem when I had that program in Windows Server 2003 R2 - 32bit, or in Windows XP 32-bit.

我了解有关Microsoft希望人们不要在Windows Server 2008中使用Office Automation的问题.Microsoft希望人们使用XML或类似的东西.但我也了解人们已经尝试过并且可以解决此问题.因为我不是该程序的开发人员,所以我真的不想开始更改该程序.因此,我希望能够使现有程序正常工作.

I understand the issue about Microsoft want people not to use Office Automation in Windows Server 2008. And Microsoft wants people to use XML or something like that. But I also understand that people have tried this and can work around this. Because I am not the developer of that program, I really don't want to start changing that program. Therefore, I would like to be able to get the existing program to work.

请帮助.预先感谢.

Jay Chan

推荐答案

原来,此问题与访问权限有关.好像ASP.NET在用户的身份验证下运行(这并不奇怪,因为我已将Web服务设置为使用"Windows身份验证").而且用户无权直接在服务器上运行Excel.解决方案是使用特殊域用户帐户:(1)将特殊用户帐户分配为本地管理员,(2)将特殊用户帐户分配为Web服务的"ASP.NET模拟"的特定用户".

Turned out this problem has to do with access rights. Seem like ASP.NET was running under the user's authentication (not surprising because I have set the web service to use "Windows Authentication"). And the user doesn't have permission to run Excel directly at the server. The solution is to use a special domain user account: (1) Assign the special user account as the local admin, (2) Assign the special user account as the "Specific user" for "ASP.NET Impersonation" for the web service.

我觉得特殊用户帐户已以某种方式嵌入到该特定Web服务中.因此,我上面提到的修复程序可能对别人也可能无效.不幸的是,我不知道这是否成立,因为我不是该Web服务的开发人员.而且我在Web服务中找不到任何地方提及与该特定用户帐户有关的任何内容.

I have a feeling that the special user account was somehow embedded in that specific web service. Therefore, the fix that I mentioned above may or may not work for other people. Unfortunately I don't know if this is true or not because I was not the developer of that web service. And I cannot find any where in the web service mentioning anything related to that specific user account.

我很高兴此问题已解决.

I am glad that this is fixed.

Jay Chan

这篇关于IIS无法为用户获得对Excel文件的访问,但是对我来说是可以的.为什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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