[英]File not found exception - windows phone
I am trying to integrate Google oAuth 2.0 in my windows phone app.My client_secret.json file in the root directory of my project and its build action is set to content. 我正在尝试将Google oAuth 2.0集成到我的Windows Phone应用中。我的client_secret.json文件位于项目的根目录中,其构建操作已设置为content。 Here is my code 这是我的代码
var credential = await GoogleWebAuthorizationBroker.AuthorizeAsync(
new FileStream("../client_secrets.json", FileMode.Open, FileAccess.Read),
new[] { DriveService.Scope.Drive },
"user",
CancellationToken.None);
I am getting the following error 我收到以下错误
System.IO.FileNotFoundException: Could not find file 'C:\\Data\\Programs{68788282-E5AD-4D0C-84DA-C5F8EB50D947}\\client_secrets.json' System.IO.FileNotFoundException:找不到文件'C:\\ Data \\ Programs {68788282-E5AD-4D0C-84DA-C5F8EB50D947} \\ client_secrets.json'
I think your path is broken some way? 我认为您的道路有些破损?
This is a wild guess, but does it solve when you try this? 这是一个很疯狂的猜测,但是当您尝试这样做可以解决吗?
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.