【问题标题】:AD RMS Managed Code Error The system cannot find the file specified. HRESULT: 0x80070002AD RMS 托管代码错误 系统找不到指定的文件。 HRESULT:0x80070002
【发布时间】:2013-07-25 13:10:22
【问题描述】:

我是 Active Directory 权限管理服务 (AD RMS) 的新手,我正在开发一个应用程序来使用 AD RMS 来加密一些文档。我正在使用互操作示例,但出现错误 - 系统找不到指定的文件。 HRESULT:0x80070002 - 当我尝试运行下面的代码时:

当我尝试运行此语句时出现错误:

集合 ipcTemplates = IPC.GetTemplates();

internal static class IPC
{
     static IPC()
     {
          SafeNativeMethods.IpcInitialize();
     }

     public static Collection<TemplateInfo> GetTemplates()
     {
          Collection<TemplateInfo> templates = null;

          try
          {
               templates = SafeNativeMethods.IpcGetTemplateList(null, true, true,
                                false, false, null, null);
          }
          catch (Exception /*ex*/)
          {
              /* TODO: Add logging */
              throw; 
          }

          return templates;
     }
}

堆栈跟踪:

系统找不到指定的文件。 HRESULT:0x80070002 在 c:\Microsoft.InformationProtectionAndControl\SafeNativeMethods.cs:line 1678 中的 Microsoft.InformationProtectionAndControl.SafeNativeMethods.ThrowOnErrorCode(Int32 hrError) 在 Microsoft.InformationProtectionAndControl.SafeNativeMethods.IpcGetTemplateList(ConnectionInfo connectionInfo, Boolean forceDownload, Boolean suppressUI, Boolean offline, Boolean hasUserConsent, Form parentForm, CultureInfocultureInfo) 在 c:\Microsoft.InformationProtectionAndControl\SafeNativeMethods.cs:line 137 在 c:\IPC.cs 中的 IPC.GetTemplates()

另外,我设置了一个构建后事件,以确保每次编译代码时都会创建清单文件。该应用程序是托管在 Windows 服务中的 WCF 服务。我有一个非常简单的控制台应用程序。

任何帮助解决此错误以及使用托管代码的任何 AD RMS 示例将不胜感激 :)

【问题讨论】:

    标签: active-directory rights-management


    【解决方案1】:

    对于可能遇到此问题的其他人,我可以通过添加 SafeNativeMethods.IpcSetAPIMode(APIMode.Server); 来解决我的问题。像这样对我的静态构造函数:

    static IPC()
        {
            SafeNativeMethods.IpcInitialize();
            SafeNativeMethods.IpcSetAPIMode(APIMode.Server);
        }
    

    【讨论】:

    • 您是如何让 RMS 对当前用户进行身份验证的?我不断收到错误消息说它不能这样做。
    猜你喜欢
    • 1970-01-01
    • 2019-05-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-12-07
    • 2016-09-19
    相关资源
    最近更新 更多