[英]GoogleWebAuthorizationBroker - Access to the path 'C:\Windows\system32\config\systemprofile' is denied
I'm using the Google Analytics reporting API v4 (c#) to get data. 我正在使用Google Analytics(分析)报告API v4(c#)来获取数据。 I use this code below to authorize.
我使用下面的代码进行授权。 On my local machine evering works fine.
在我的本地计算机上,evering可以正常工作。 But on my production-server I get the error: "Access to the path 'C:\\Windows\\system32\\config\\systemprofile' is denied."
但是在生产服务器上,我收到错误消息:“拒绝访问路径'C:\\ Windows \\ system32 \\ config \\ systemprofile'。” It's not related to folder/file read write permissions because I read from an online sorce.
它与文件夹/文件的读写权限无关,因为我是从在线资源中读取的。 I can't figure this one out.... Heres my code:
我想不通这一点...。这是我的代码:
var client = new WebClient(); var client = new WebClient();
var stream = client.OpenRead("https://api.myjson.com/bins/drj87");
var loginEmailAddress = ConfigurationManager.AppSettings["AnalyticsReporting.Email"];
return await GoogleWebAuthorizationBroker.AuthorizeAsync(
GoogleClientSecrets.Load(stream).Secrets,
new[] { AnalyticsReportingService.Scope.Analytics },
loginEmailAddress, CancellationToken.None,
new FileDataStore("GoogleAnalyticsApiConsole"));
From https://developers.google.com/api-client-library/dotnet/reference/1.9.1/classGoogle_1_1Apis_1_1Util_1_1Store_1_1FileDataStore : 来自https://developers.google.com/api-client-library/dotnet/reference/1.9.1/classGoogle_1_1Apis_1_1Util_1_1Store_1_1FileDataStore :
Google.Apis.Util.Store.FileDataStore.FileDataStore(string folder, bool fullPath = false)
Constructs a new file data store.
构造一个新的文件数据存储。 If fullPath is false the path will be used as relative to Environment.SpecialFolder.ApplicationData, otherwise the input folder will be treated as absolute.
如果fullPath为false,则将使用路径相对于Environment.SpecialFolder.ApplicationData的相对路径,否则输入文件夹将被视为绝对路径。 The folder is created if it doesn't exist yet.
如果该文件夹尚不存在,则会创建该文件夹。
So put the full path of a directory your service account does have permissions to, and set fullPath to true. 因此,将服务帐户确实具有权限的目录的完整路径放入,并将fullPath设置为true。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.