【问题标题】:Server Authentication in Windows Run Time Component for background agent后台代理的 Windows 运行时组件中的服务器身份验证
【发布时间】:2023-03-08 11:01:02
【问题描述】:

我正在开发一个 Windows Phone 项目,该项目使用 gmail api 从 gmail 服务器提取数据并下载具有特定格式的所有附件,当我拥有所有代码时,一切正常(服务器身份验证、接收数据……)在同一个项目中。 我在解决方案中添加了一个 Windows 运行时组件项目,并将处理服务器身份验证并将 GmailService 返回到运行时组件项目的代码移到了运行时组件项目中,因此我可以从后台代理调度程序项目以及主项目中调用它以进行推送通知。 每次尝试在主项目中调用服务器时都会出现此错误:

“System.Runtime.InteropServices.COMException”类型的异常发生在 mscorlib.ni.dll 中,但未在用户代码中处理

 public static async Task<GmailService> Instantiate()
    {
        if (service == null)
            await AuthenticateAsync();
        return service;
    }

    private static async Task AuthenticateAsync()
    {
          // the code that creates the service if it doesn't exist
     }

我添加了对调度程序和主项目的引用,并且构建成功完成。

【问题讨论】:

    标签: c# authentication windows-phone-8.1 gmail-api background-agents


    【解决方案1】:

    这个线程(下面的链接)建议以管理员身份运行 VS,以及如何调试 COMException 以更好地了解导致它的原因。听起来您创建的新 VS 项目的目标架构存在问题。摘录如下;

    “您可以在抛出异常时尝试中断。转到 Debug > Exceptions... 并使用 Find... 选项找到 System.Runtime.InteropServices.COMException。勾选该选项以在抛出异常时中断,然后调试您的应用程序。”

    How to avoid a System.Runtime.InteropServices.COMException?

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-11-21
      • 1970-01-01
      • 2011-07-31
      • 1970-01-01
      相关资源
      最近更新 更多