【发布时间】:2016-04-11 03:37:47
【问题描述】:
我在将代码发布到 IIS7.0 后遇到 GoogleWebAuthorizationBroker.AuthorizeAsync 超时问题。
通过我的开发环境,一切都按预期工作。我看到了 Google 权限屏幕,代码在 App_data 中创建了预期的令牌文件。然后我可以插入和更新日历条目。 但是,当我发布代码时,我从 GoogleWebAuthorizationBroker.AuthorizeAsync 收到请求超时错误。
我已手动将从我的开发环境创建的令牌文件复制到 Web 服务器上,并且代码工作正常。我可以在日历中创建事件。
我已经监控了防火墙,没有任何东西被阻止。
如果我删除 Web 服务器上令牌文件的内容。系统不会提示我重新授权并返回请求超时。
有人对出了什么问题有任何建议吗?
ClientSecrets client = new ClientSecrets
{
ClientId = SessionState.SystemSettings[SystemSettingKey.GoogleAccountClientId].Value,
ClientSecret = SessionState.SystemSettings[SystemSettingKey.GoogleAccountClientSecret].Value
};
IList<string> scopes = new List<string>();
scopes.Add(CalendarService.Scope.Calendar);
var credPath = HttpContext.Current.Server.MapPath("~/App_Data/");
var credential =
GoogleWebAuthorizationBroker.AuthorizeAsync(client, scopes, account, CancellationToken.None, new FileDataStore(credPath, true))
.Result;
// Create the calendar service using an initializer instance
BaseClientService.Initializer initializer = new BaseClientService.Initializer
{
HttpClientInitializer = credential,
ApplicationName = "App1"
};
【问题讨论】:
-
请求执行不返回?
-
在开发环境中它执行并返回,但是当它编译并安装在网络服务器上时,它只是坐在那里等待返回。但是,从我所看到的情况来看,防火墙上没有任何东西被阻止
标签: c# asp.net async-await