[英]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.