gpt4 book ai didi

asp.net-mvc - 发出请求时 Google API 客户端库在 IIS 中卡住

转载 作者:行者123 更新时间:2023-12-01 20:18:02 25 4
gpt4 key购买 nike

我一直在使用 Google API Client Library for .NET将 Google Analytics 数据加载到我的应用程序中:

最近我发现它已经开始完全卡住了。 Execute() 命令建立与 Google 服务器的连接。

它向以下对象发出成功的请求:

 https://accounts.google.com/o/oauth2/token

它返回类似的内容:

{
"access_token" : "ya30.HAKlQSGZo2GnK5wxlxx9TLTQUyD9Xkt7AZxuQnDY-KhJuCyrCtN_xHIP",
"token_type" : "Bearer",
"expires_in" : 3600
}

但之后永远不会从 Execute 调用中返回。

控制台应用程序中的相同代码会立即返回,但在 IIS 中它目前永远不会返回。

在以前的版本中它工作得很好(我不太确定它改变了哪个版本)。

我已将加载用户配置文件设置为true。

这可能是什么原因造成的?

   var SERVICE_ACCOUNT_PKCS12_FILE_PATH = @"C:\TEMP\GoogleAnalytics-privatekey.p12";
X509Certificate2 certificate = new X509Certificate2(SERVICE_ACCOUNT_PKCS12_FILE_PATH, "notasecret", X509KeyStorageFlags.MachineKeySet | X509KeyStorageFlags.PersistKeySet | X509KeyStorageFlags.Exportable);


// Create credentials (not my real login here)
ServiceAccountCredential credential = new ServiceAccountCredential(
new ServiceAccountCredential.Initializer("86987278011-ctegcus4og7kn6oigkrv8po5pf67bbgj@developer.gserviceaccount.com")
{
Scopes = new[] { AnalyticsService.Scope.AnalyticsReadonly }
}.FromCertificate(certificate));

// Create the service
var service = new AnalyticsService(new BaseClientService.Initializer()
{
HttpClientInitializer = credential,
ApplicationName = "Google Analytics Application",

});

// get accounts
accounts = service.Management.Accounts.List();
var items = accounts.Execute();

最佳答案

Google Calendar API - Not Returning From Execute() C# 中所述,我们目前在最新版本的 Google.Apis.Auth v 1.9.3 中存在错误。

我们已经在我们的存储库 ( https://github.com/google/google-api-dotnet-client ) 中修复了该问题,因此您可以使用 Analytics API ( https://developers.google.com/resources/api-libraries/download/analytics/v3/csharp ) 自行测试。

该库的新版本计划在未来几周内发布,敬请期待 - http://google-api-dotnet-client.blogspot.com/


更新(12 月 15 日):1.10.0 的新 NuGet 包已可用,请在以下位置了解更多信息: http://google-api-dotnet-client.blogspot.com/2015/12/announcing-release-of-1100.html

关于asp.net-mvc - 发出请求时 Google API 客户端库在 IIS 中卡住,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33445453/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com