.Net Framework/C# – –grpc_out: protoc-gen-grpc: Access is denied issue.

huangapple go评论93阅读模式
英文:

.Net Framework/C# - --grpc_out: protoc-gen-grpc: Access is denied issue

问题

我有一个.Net 4.7.2项目,我已经使用NuGet包v2.26.0设置了我的Messages项目。我的环境变量中有protoc,并且可以运行命令,比如protoc --version等。

尝试生成我的grpc代码时,我运行以下命令:

C:\Samples\MyGrpc>protoc -I .\pb --csharp_out .\Grpc\Messages .\pb\messages.proto --grpc_out .\Grpc\Messages --plugin=protoc-gen-grpc=.\Grpc\packages\Grpc.Tools.2.26.0\tools\windows_x64
--grpc_out: protoc-gen-grpc: 拒绝访问。

我是以管理员身份打开的Windows cmd提示符运行此命令。

我的主Visual Studio项目文件夹是Grpc,其中包含Message项目。

我不确定被拒绝访问什么。有什么想法吗?

谢谢!

英文:

I have a .Net 4.7.2 project and I've set my Messages project up with the NuGet package v2.26.0. I have protoc in my environments file path and can run commands like protoc --version etc.

When trying to generate my grpc code, I run the following command:

C:\Samples\MyGrpc>protoc -I .\pb --csharp_out .\Grpc\Messages .\pb\messages.proto --grpc_out .\Grpc\Messages --plugin=protoc-gen-grpc=.\Grpc\packages\Grpc.Tools.2.26.0\tools\windows_x64
--grpc_out: protoc-gen-grpc: Access is denied.

I am running this command from a Windows cmd prompt opened as Administrator.

My main Visual Studio project folder is Grpc with the Message project under it.

I'm unsure what I'm being denied access to. Any ideas?

Thanks!

答案1

得分: 3

我发现问题是在--plugin命令中,我必须输入插件可执行文件的名称,即包括.exe名称在内的完整路径。然后它就能正常工作了。

C:\Samples\MyGrpc>protoc -I .\pb --csharp_out .\Grpc\Messages .\pb\messages.proto --grpc_out .\Grpc\Messages --plugin=protoc-gen-grpc=.\Grpc\packages\Grpc.Tools.2.26.0\tools\windows_x64\grpc_csharp_plugin.exe

谢谢!

英文:

I figured out that the problem was that in the --plugin command, I had to put the name of the plugin executable, ie, the whole path including .exe name. It worked then.

C:\Samples\MyGrpc>protoc -I .\pb --csharp_out .\Grpc\Messages .\pb\messages.proto --grpc_out .\Grpc\Messages --plugin=protoc-gen-grpc=.\Grpc\packages\Grpc.Tools.2.26.0\tools\windows_x64\grpc_csharp_plugin.exe

Thanks!

huangapple
  • 本文由 发表于 2020年1月7日 00:27:17
  • 转载请务必保留本文链接:https://go.coder-hub.com/59615603.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定