I've been strugling in the past few days with an Asp.Net MVC website which has to use the Google Apis (Calendar) It works just fine in ASP.Net Developement Server, or IISExpress, but it just won't work on IIS 7.5.
Here's the basic authentication code :
private async Task Run()
{
UserCredential credential = GoogleWebAuthorizationBroker.AuthorizeAsync(new ClientSecrets
{
ClientId = "xxxxxxx",
ClientSecret = "xxxxx",
},
new[] { CalendarService.Scope.Calendar },
"xxx@gmail.com",
CancellationToken.None).Result;
and on IIS I always get this :
[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
(The exception text means "Access to the path 'Google.Apis.Auth' is denied)
I had the problem with the previous version API version, upgraded to the 1.8.1.31688 version but the error remains... My app pool runs under Network Service identity, I gave it full-control access to my website folder (I even gave "Everyone" full control, just in case...) but same result.
Same symptom on my dev computer (which can be overriden using IISExpress) and the prod server, which is more "annoying"...
Thanks for any help you may bring to me !