gpt4 book ai didi

iis - 检索具有 CLSID {000209FF-0000-0000-C000-000000000046} 的组件的 COM 类工厂

转载 作者:行者123 更新时间:2023-12-04 23:58:21 24 4
gpt4 key购买 nike

我使用 Windows XP_SP_3 和 IIS 5(本地主机),使用 asp.net4 构建站点并使用以下代码:

Application appClass = new Application();
Document wordDoc = appClass.Documents.Add(Server.MapPath("~") + @"Files\tmp.docx");
wordDoc.SaveAs(@"e:\hp\Files\" + TextBox1.Text + ".docx");
wordDoc.Close();
如果使用 VS2010 运行站点,则可以。但如果使用 IIS 5(本地主机)运行,则显示此错误:

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 , 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:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.



我打开组件服务 > 计算机 > 在我的电脑中右键单击 > 选择属性 > COM Sucrity > 启动和激活... > 编辑默认值 > 添加 > 高级 >
我没有找到用户 IIS (IIS_IUSRS)。所以选择 ASP.NET 并确定并检查本地启动和远程启动和本地激活和远程激活。
休息系统并再次使用 iis5 运行站点。但再次显示错误!

最佳答案

  • 转到 控制面板 -> 管理工具 -> 组件
    服务
  • 通过单击组件服务展开树 ->
    计算机 -> 我的电脑 -> DCOM 配置
  • 搜索 CLSId
    00020906-0000-0000-C000-000000000046 (用于word应用)
    注意:如果搜索 CLSId 未找到,则通过“Windows Word 应用程序”进行搜索。
  • 通过选择
    00020906-0000-0000-C000-000000000046 此 CLSId 现在右键单击“属性”
  • 在属性区域中,单击安全选项卡。
  • 从所有选项中选择自定义选项(启动和激活
    权限、访问权限、配置权限)。
  • 全部添加新名称为 NETWORK SERVICE,并允许所有权限
    这个名字。
  • 转到同一属性区域中的身份选项卡,选择
    选项作为 该用户 然后添加用户名(这是
    native 管理员)和密码。点击应用,确定。
  • 刷新组件服务并检查您的应用程序是否正常工作
    好不好。
  • 关于iis - 检索具有 CLSID {000209FF-0000-0000-C000-000000000046} 的组件的 COM 类工厂,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13890906/

    24 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com