问题描述
大家好
我在这里有一个小问题.我实际上是在尝试对word文档进行页面计数,并且它在本地环境中可以很好地工作.然后将我的项目转移到服务器,页面计数开始给我一个错误,说
由于以下错误,检索具有CLSID {000209FF-0000-0000-C000-000000000046}的组件的COM类工厂失败:80070005访问被拒绝. (来自HRESULT的异常:0x80070005(E_ACCESSDENIED)).
说明:执行当前Web请求期间发生未处理的异常.请查看堆栈跟踪,以获取有关错误及其在代码中起源的更多信息.
异常详细信息:System.UnauthorizedAccessException:检索具有CLSID {000209FF-0000-0000-C000-000000000046}的组件的COM类工厂失败,原因是存在以下错误:80070005访问被拒绝. (来自HRESULT的异常:0x80070005(E_ACCESSDENIED)).
没有授权ASP.NET访问请求的资源.考虑将资源的访问权限授予ASP.NET请求标识. ASP.NET具有一个基本进程标识(在IIS 5上通常为{MACHINE} \ ASPNET,在IIS 6和IIS 7上通常为Network Service,在IIS 7.5上通常为已配置的应用程序池标识),如果应用程序无法模拟,则使用该标识.如果应用程序正在通过< identity impersonate ="true">进行模拟,则该身份将是匿名用户(通常为IUSR_MACHINENAME)或经过身份验证的请求用户.
要授予ASP.NET对文件的访问权限,请在资源管理器中右键单击该文件,选择属性",然后选择安全性"选项卡.单击添加"以添加适当的用户或组.突出显示ASP.NET帐户,然后选中所需访问权限的框.
源错误:
第386行:Microsoft.Office.Interop.Word.ApplicationClass WordApp =新的Microsoft.Office.Interop.Word.ApplicationClass();//此行中的错误
如何解决此问题.....
Hi All
I have a small issue here.Im actually trying to do a page count of word documents and it rilly works fine in the local envirnment.Then a shifted my project to server and the page count started giving me an error saying
Retrieving the COM class factory for component with CLSID {000209FF-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 {000209FF-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:
Line 386: Microsoft.Office.Interop.Word.ApplicationClass WordApp = new Microsoft.Office.Interop.Word.ApplicationClass();//error in this line
How to resolve this issue.....
推荐答案
这篇关于Word Doc的页数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!