簡體   English   中英

找不到文件異常-Windows Phone

[英]File not found exception - windows phone

我正在嘗試將Google oAuth 2.0集成到我的Windows Phone應用中。我的client_secret.json文件位於項目的根目錄中,其構建操作已設置為content。 這是我的代碼

 var credential = await GoogleWebAuthorizationBroker.AuthorizeAsync(
                   new FileStream("../client_secrets.json", FileMode.Open, FileAccess.Read),
                   new[] { DriveService.Scope.Drive },
                   "user",
                   CancellationToken.None);

我收到以下錯誤

System.IO.FileNotFoundException:找不到文件'C:\\ Data \\ Programs {68788282-E5AD-4D0C-84DA-C5F8EB50D947} \\ client_secrets.json'

我認為您的道路有些破損?

這是一個很瘋狂的猜測,但是當您嘗試這樣做可以解決嗎?

string yourpath = Environment.CurrentDirectory + @"\client_secrets.json";

var credential = await GoogleWebAuthorizationBroker.AuthorizeAsync(
                   new FileStream(yourpath, FileMode.Open, FileAccess.Read),
                   new[] { DriveService.Scope.Drive },
                   "user",
                   CancellationToken.None);

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM