简体   繁体   English

GoogleWebAuthorizationBroker-拒绝访问路径'C:\\ Windows \\ system32 \\ config \\ systemprofile'

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

相关问题 访问路径 'c:\windows\system32\inetsrv\config\' 被拒绝 - Access to the path 'c:\windows\system32\inetsrv\config\' is denied 如何在 C# 中获取 Windows\system32\config\systemprofile\AppData\Local\ 文件夹路径? - How to get Windows\system32\config\systemprofile\AppData\Local\ folder path in C#? 拒绝访问路径“ C:\\ Windows \\ System32 \\” - Access to the path 'C:\Windows\System32\ is denied 权限错误 C:\WINDOWS\system32\config\systemprofile\.EasyOCR in IIS app which uses Python EXE - Permission Error C:\WINDOWS\system32\config\systemprofile\.EasyOCR in IIS app which uses Python EXE C#错误Windows启动时,对路径'C:\\ Windows \\ system32 \\ Com \\ dmp'的访问被拒绝 - C# Error Access to the path 'C:\Windows\system32\Com\dmp' is denied When Windows Startup EF6添加迁移失败-拒绝访问路径'C \\ WINDOWS \\ SYSTEM32 \\ MyContext.edmx' - EF6 add migration fails - Access to the path 'C\WINDOWS\SYSTEM32\MyContext.edmx' is denied WebClient下载-“拒绝访问路径'c:\\\\ windows \\\\ system32 \\\\ inetsrv \\\\ MyPrintManager.exe'” - WebClient Download - “Access to the path 'c:\\windows\\system32\\inetsrv\\MyPrintManager.exe' is denied” “访问路径'D:\\\\ Windows \\\\ system32 \\\\文件被拒绝”Azure Web App - “Access to the path 'D:\\Windows\\system32\\file is denied” Azure Web App 在C#中访问System32 \\ config \\ SYSTEM配置单元 - Access System32\config\SYSTEM hive in C# 如何使用c#asp.net获取C:\\ Windows \\ System32 \\ inetsrv \\ config文件夹的访问控制 - How to get access control of C:\Windows\System32\inetsrv\config folder using c# asp.net
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM