Accessing Google Cloud Datastore locally from ASP.NET throws Grpc.Core.RpcException: “Missing or insufficient permissions.”

青春壹個敷衍的年華 提交于 2019-12-11 16:16:17

问题


I'm following the Using Cloud Datastore with .NET tutorial. At some point it says that you can run the provided project locally by just pressing F5. When I do that I get the following exception

Grpc.Core.RpcException: 'Status(StatusCode=PermissionDenied, Detail="Missing or insufficient permissions.")'

This exception is thrown exactly at the _db.RunQuery(query) line.

var query = new Query("Book") { Limit = pageSize };
if (!string.IsNullOrWhiteSpace(nextPageToken))
    query.StartCursor = ByteString.FromBase64(nextPageToken);
var results = _db.RunQuery(query);`

If I deploy the application to cloud it works as expected, no error. I've given datastore owner permissions to all accounts in Cloud IAM (Identity and Access Management) but it still doesn't work. Does anybody have any ideas?


回答1:


As Jon Skeet pointed out, I was using the wrong json key locally. Previously I created a compute engine that has a separate service account. After I downloaded a new json key from Console -> IAM & Admin -> Service Accounts it worked locally as well.



来源:https://stackoverflow.com/questions/48719868/accessing-google-cloud-datastore-locally-from-asp-net-throws-grpc-core-rpcexcept

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!