简体   繁体   English

将 gRPC 服务部署到 Azure Linux 应用服务 - 端口未打开

[英]Deploy gRPC service to Azure Linux App Service - port not open

I created a gRPC service using C#.我使用 C# 创建了一个 gRPC 服务。 Locally this service works.该服务在本地有效。 For HTTP/2 I used port 8585. I have also gRPC-Web implemented, so all methods can be called using HTTP REST API requests as well as via gRPC calls.对于 HTTP/2,我使用端口 8585。我还实现了 gRPC-Web,因此可以使用 HTTP REST API 请求以及通过 gRPC 调用来调用所有方法。

Now when deployed to a Linux App Service on Azure, I can open https://xxx.azurewebsites.net/version via the web browser and I receive the version number in JSON.现在,当部署到 Azure 上的 Linux 应用服务时,我可以通过 Web 浏览器打开https://xxx.azurewebsites.net/version并收到 JSON 格式的版本号。

But trying this from Windows PowerShell: .\grpcurl xxx.azurewebsites.net:8585 bonviewapi.BonView/Version gives: Failed to dial target host "xxx.azurewebsites.net:8585": context deadline exceeded但是从 Windows PowerShell 尝试这个: .\grpcurl xxx.azurewebsites.net:8585 bonviewapi.BonView/Version 给出: Failed to dial target host "xxx.azurewebsites.net:8585": context deadline exceeded

I followed these instructions to deploy the gRPC service: https://github.com/Azure/app-service-linux-docs/blob/master/HowTo/gRPC/use_gRPC_with_dotnet.md我按照以下说明部署 gRPC 服务: https ://github.com/Azure/app-service-linux-docs/blob/master/HowTo/gRPC/use_gRPC_with_dotnet.md

But nmap shows port 8585 is not open:但 nmap 显示端口 8585 未打开:

nmap -p 8585 xxx.azurewebsites.net nmap -p 8585 xxx.azurewebsites.net

PORT STATE SERVICE 8585/tcp filtered unknown端口状态服务 8585/tcp 过滤未知

In Azure portal if I look at "Log Streams", I see:在 Azure 门户中,如果我查看“日志流”,我会看到:

2022-05-27T14:54:03.092Z INFO - docker run -d -p 8080:8080 --name bonviewapi_6_4697c7ec -e WEBSITE_SITE_NAME=bonviewapi -e WEBSITE_AUTH_ENABLED=False -e WEBSITE_ROLE_INSTANCE_ID=0 -e WEBSITE_HOSTNAME=bonviewapi.azurewebsites.net -e WEBSITE_INSTANCE_ID=075e97bea78adeb84472f3759e2f2bed6e7ee50a77bbe5ffb3096255854fdab0 -e HTTP_LOGGING_ENABLED=1 appsvc/dotnetcore:lts_20211110.1 2022-05-27T14:54:03.092Z 信息 - docker run -d -p 8080:8080 --name bonviewapi_6_4697c7ec -e WEBSITE_SITE_NAME=bonviewapi -e WEBSITE_AUTH_ENABLED=False -e WEBSITE_ROLE_INSTANCE_ID=0 -e WEBSITE_HOSTNAME=bonviewapi.azurewebsite-net e WEBSITE_INSTANCE_ID=075e97bea78adeb84472f3759e2f2bed6e7ee50a77bbe5ffb3096255854fdab0 -e HTTP_LOGGING_ENABLED=1 appsvc/dotnetcore:lts_20211110.1

Also see:另见:

2022-05-27T22:42:11.764179274Z [40m[32minfo[39m[22m[49m: Microsoft.Hosting.Lifetime[14] 2022-05-27T22:42:11.764246376Z Now listening on: http://[::]:8080 2022-05-27T22:42:11.772259840Z [40m[32minfo[39m[22m[49m: Microsoft.Hosting.Lifetime[14] 2022-05-27T22:42:11.772301442Z Now listening on: http://[::]:8585 2022-05-27T22:42:11.772311542Z [40m[32minfo[39m[22m[49m: Microsoft.Hosting.Lifetime[0] 2022-05-27T22:42:11.772319542Z Application started. 2022-05-27T22:42:11.764179274Z [40m[32minfo[39m[22m[49m: Microsoft.Hosting.Lifetime[14] 2022-05-27T22:42:11.764246376Z 现在收听:http://[:: ]:8080 2022-05-27T22:42:11.772259840Z [40m[32minfo[39m[22m[49m: Microsoft.Hosting.Lifetime[14] 2022-05-27T22:42:11.772301442Z 现在收听:http:// [::]:8585 2022-05-27T22:42:11.772311542Z [40m[32minfo[39m[22m[49m: Microsoft.Hosting.Lifetime[0] 2022-05-27T22:42:11.772319542Z 应用程序已启动。 Press Ctrl+C to shut down.按 Ctrl+C 关闭。 2022-05-27T22:42:11.772343943Z [40m[32minfo[39m[22m[49m: Microsoft.Hosting.Lifetime[0] 2022-05-27T22:42:11.772352243Z Hosting environment: Development 2022-05-27T22:42:11.772375144Z [40m[32minfo[39m[22m[49m: Microsoft.Hosting.Lifetime[0] 2022-05-27T22:42:11.772383644Z Content root path: /home/site/wwwroot 2022-05-27T22:42:11.772343943Z [40m[32minfo[39m[22m[49m: Microsoft.Hosting.Lifetime[0] 2022-05-27T22:42:11.772352243Z 托管环境:开发 2022-05-27T22:42 :11.772375144Z [40m[32minfo[39m[22m[49m: Microsoft.Hosting.Lifetime[0] 2022-05-27T22:42:11.772383644Z 内容根路径:/home/site/wwwroot

How can I trouble shoot this problem.我该如何解决这个问题。 Did I overlook something?我忽略了什么吗? How to open port 8585 for the Azure Linux App Service?如何为 Azure Linux 应用服务打开 8585 端口?

Best regards, Rene最好的问候,雷内

One needs to read carefully ;).需要仔细阅读;)。

https://github.com/Azure/app-service-linux-docs/blob/master/HowTo/gRPC/use_gRPC_with_dotnet.md states: https://github.com/Azure/app-service-linux-docs/blob/master/HowTo/gRPC/use_gRPC_with_dotnet.md状态:

"The following documentation is dependent on a future release of App Service that is not currently available to the public. gRPC is currently available to try in EUAP with Private Preview". “以下文档取决于当前不向公众提供的应用服务的未来版本。gRPC 目前可在 EUAP 中试用私有预览版”。

Here is an excellent post on LinkedIn explaining the differences between GA (Generally Available), Public Preview and Private Preview:这是 LinkedIn 上的一篇精彩文章,解释了 GA(普遍可用)、公共预览版和私人预览版之间的区别:

https://www.linkedin.com/pulse/differences-between-ga-private-public-preview-azure-radu-vunvulea/?trk=articles_directory https://www.linkedin.com/pulse/differences-between-ga-private-public-preview-azure-radu-vunvulea/?trk=articles_directory

So to deploy gRPC services onto a Azure App Service is currently not possible, only people invited by the Product Team can try out the Private Preview.因此,目前无法将 gRPC 服务部署到 Azure App Service 上,只有产品团队邀请的人员才能试用 Private Preview。

As a workaround I will implement gRPC-Web as well such that I can deploy on Azure, but then will be using HTTP REST API calls implemented through gRPC (well, yes, most of the gRPC benefits are then void).作为一种解决方法,我还将实现 gRPC-Web 以便我可以在 Azure 上部署,但随后将使用通过 gRPC 实现的 HTTP REST API 调用(嗯,是的,大多数 gRPC 的好处都将失效)。 Hopefully gRPC support for App Service makes it quickly to Public Review and/or GA.希望 gRPC 对 App Service 的支持能够快速进入公共审查和/或 GA。

Otherwise I still have the option to host gRPC in IIS or by installing Kestrel on a Linux VM which definitely should already be possible today.否则,我仍然可以选择在 IIS 中托管 gRPC,或者在 Linux VM 上安装 Kestrel,这在今天肯定已经可以实现。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无法在 Azure 应用服务 Linux 中部署 NodeJS(Fastify 应用) - Unable to deploy NodeJS (Fastify app) in Azure App Service Linux 如何构建 netcore 3.0 Webapi 并部署到 Azure Linux 应用服务 - How to build a netcore 3.0 Webapi and deploy to an Azure Linux app service 如何在Azure Linux应用服务上托管的应用中打开端口 - How to open ports to in Apps hosted on Azure Linux App Service Azure Linux 应用服务:从 Devops 管道部署后安装包 - Azure Linux App Service : Installing packages after deploy from Devops pipeline 如何在单个基于 linux 的 azure 应用服务中部署多个 .net 核心应用程序 - how to deploy multiple .net core application in single linux based azure app service 对 Azure Linux 应用服务中运行的容器进行健康检查 - HealthCheck for the containers running in the Azure Linux App service 关于Linux计划的Azure应用服务计划编码问题 - Azure App Service on Linux plan encoding issue Azure 应用服务 Linux 安装依赖项 - Azure App service Linux install dependencies linux deploy,kali,在启动后启动应用程序服务 - linux deploy, kali, start an app service after its boots up 使用 Azure DevOps 在 Azure 应用服务中永久安装 Linux 依赖项 - Install Linux dependencies in Azure App Service permanently using Azure DevOps
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM