[英]Server Authentication in Windows Run Time Component for background agent
我正在一個Windows Phone項目中,該項目使用gmail api從gmail服務器提取數據並下載具有特定格式的所有附件,當我在同一代碼中擁有所有代碼時,一切工作正常(服務器身份驗證,接收數據等)項目。 我向解決方案中添加了Windows運行時組件項目,並將處理服務器身份驗證的代碼移到了運行時組件項目中,並將GmailService返回給運行時組件項目,因此我可以從后台代理調度程序項目中調用它,以進行推送通知,也可以在主項目中進行調用。 每次嘗試在主項目中調用服務器時,都會出現此錯誤:
mscorlib.ni.dll中發生了類型為'System.Runtime.InteropServices.COMException'的異常,但未在用戶代碼中處理
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
}
我對調度程序和主項目都添加了參考,並且構建成功完成。
該線程(在鏈接下方)建議以管理員身份運行VS,並建議如何調試COMException以更好地了解引起此錯誤的原因。 聽起來您創建的新VS項目的目標體系結構有問題。 摘錄如下;
“您可以嘗試在引發異常時中斷。轉到Debug> Exceptions ...並使用Find ...選項找到System.Runtime.InteropServices.COMException。勾選該選項以在引發異常時中斷,然后調試應用程序”。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.