I'm working with Google Drive API v3 in ASP.NET Core WebApi project but it's not working on IIS. It works fine locally via Visual Studio 2017 on Kestrel server. However if I try to deploy on IIS it hangs.
Code snippet for listing image files located in a folder:
public static Google.Apis.Drive.v3.Data.FileList ListFiles(DriveService service, string folderId)
{
try
{
var request = service.Files.List();
request.PageSize = 100;
request.Fields = "nextPageToken, files(id, name)";
if (!String.IsNullOrEmpty(folderId))
{
request.Q = "'" + folderId + "' in parents " + " and mimeType='image/jpeg'";
}
return request.Execute();
}
catch (Exception ex)
{
throw new Exception("Request failed.", ex);
}
}
I know well Google Drive API supports OAuth 2.0 for web spplications (ASP.NET MVC) as described here: https://developers.google.com/api-client-library/dotnet/guide/aaa_oauth#web-applications-aspnet-mvc
Please help. Thanks.