【发布时间】:2014-04-01 11:40:29
【问题描述】:
过去几天我一直在为一个必须使用 Google API(日历)的 Asp.Net MVC 网站而苦苦挣扎 它在 ASP.Net 开发服务器或 IISExpress 中运行良好,但在 IIS 7.5 上无法运行。
这是基本的验证码:
private async Task Run()
{
UserCredential credential = GoogleWebAuthorizationBroker.AuthorizeAsync(new ClientSecrets
{
ClientId = "xxxxxxx",
ClientSecret = "xxxxx",
},
new[] { CalendarService.Scope.Calendar },
"xxx@gmail.com",
CancellationToken.None).Result;
在 IIS 上我总是得到这个:
[UnauthorizedAccessException: L'accès au chemin d'accès 'Google.Apis.Auth' est refusé.]
Microsoft.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +185
Microsoft.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccess(Task task) +114
Google.Apis.Auth.OAuth2.<AuthorizeAsync>d__1.MoveNext() in c:\code\google.com\google-api-dotnet-client\default\Tools\Google.Apis.Release\bin\Debug\output\default\Src\GoogleApis.Auth.DotNet4\OAuth2\GoogleWebAuthorizationBroker.cs:54
(异常文本的意思是“访问路径'Google.Apis.Auth'被拒绝)
之前版本API版本有问题,升级到1.8.1.31688版本还是报错... 我的应用程序池在网络服务身份下运行,我授予它对我的网站文件夹的完全控制访问权限(我什至授予“所有人”完全控制权,以防万一......)但结果相同。
在我的开发计算机(可以使用 IISExpress 覆盖)和产品服务器上出现相同的症状,这更“烦人”...
感谢您为我提供的任何帮助!
【问题讨论】:
标签: iis-7.5 google-api-dotnet-client