我使用C#创建了GRPC服务。本地服务有效。对于HTTP/2,我使用了端口8585。我还实施了GRPC-WEB,因此可以使用HTTP REST API请求以及通过GRPC调用来调用所有方法。
现在,当部署到Azure上的Linux App服务时,我可以打开 https://xxx.azurewewebers.net/version.net/version 通过Web浏览器,我在JSON中收到版本号。
但是从Windows PowerShell尝试一下:
.\grpcurl xxx.azurewebsites.net:8585 bonviewapi.BonView/Version
给出:
无法拨打目标主机“ xxx.azurewebsites.net:8585”:上下文截止日期超过我
,我遵循以下说明部署GRPC服务:
但NMAP显示端口8585不打开:
NMAP -P 8585 xxx.azurewebsites.azurewebsites.net
端口状态状态服务
8585/TCP在Azure Portal中过滤未知的话
,如果我看“日志流”,我会看到:
2022-05-27T14:54:03.092Z信息-Docker run -d -d -p 8080:8080:8080:bonviewapi_6 _6_4697c7c7ec -e bone worts toble toble toble toble toble toble toble toble toble toble toble toble toble toble_site_site_site_site_site_site_site_site_site_site_site_site_name_name = -e weblos_auth_enabled = false -e worgement_role_instance_id = 0 -e weblot_hostname = bonviewapi.azurewebsites.net -e worgement_instance_id = 075E97BEA77BEA784444772F3759E2F2BBET2BED NBED_6EEE7EE7EE7EEFBENOBL = 1 AppSVC/dotnetcore:LTS_20211110.1
另请参见:
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 [49m:Microsoft.hosting.lifeting.lifetime [14]
2022-05-27T22:42:11.772301442Z现在听:http:// [::]:8585
2022-05-27T22:42:11.772311542Z [40m [32minfo [39m [22m [49m [49m:Microsoft.hosting.lifetime [0]
2022-05-27T22:42:11.772319542Z启动了应用程序。按CTRL+C关闭。
2022-05-27T22:42:11.772343943Z [40m [32minfo [39m [22m [49m [49m:Microsoft.hosting.lifetime [0]
2022-05-27T22:42:11.772352243Z托管环境:开发
2022-05-27T22:42:11.7723751444z [40m [32minfo [39m [22m [49m [49m:Microsoft.Hosting.lifetime [0]
2022-05-27T22:42:11.772383644Z内容root Path:/home/site/wwwroot
我如何麻烦射击此问题。我忽略了什么吗?如何为Azure Linux应用服务打开端口8585?
此致,
瑞恩
I created a gRPC service using C#. 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.
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.
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
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
But nmap shows port 8585 is not open:
nmap -p 8585 xxx.azurewebsites.net
PORT STATE SERVICE
8585/tcp filtered unknown
In Azure portal if I look at "Log Streams", I see:
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
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. Press Ctrl+C to shut down.
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
How can I trouble shoot this problem. Did I overlook something? How to open port 8585 for the Azure Linux App Service?
Best regards,
Rene
发布评论
评论(1)
一个人需要仔细阅读;)。
指出:
“以下文档取决于未来的App Service的版本,该应用程序当前无法公开提供。GRPC。GRPC目前可以在私人预览中尝试使用EUAP”。
这是关于LinkedIn的出色文章,解释了GA(通常可用),公共预览和私人预览之间的差异:
https://www.linkedin.com/pulse/pulse/pulse/differences-between-between-between-ga-private-private-public-pebulic-pebulic-preview-preview-azure-radu-vunvulea/-radu-vunvulea/ ?
作为解决方法,我也将实现GRPC-WEB,以便我可以在Azure上部署,但是随后将使用通过GRPC实现的HTTP REST API调用(嗯,是的,大多数GRPC好处是无效的)。希望GRPC对应用程序服务的支持使公众审查和/或GA很快。
否则,我仍然可以选择在IIS中托管GRPC或在Linux VM上安装KESTREL,这绝对应该已经有可能。
One needs to read carefully ;).
https://github.com/Azure/app-service-linux-docs/blob/master/HowTo/gRPC/use_gRPC_with_dotnet.md states:
"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".
Here is an excellent post on LinkedIn explaining the differences between GA (Generally Available), Public Preview and Private Preview:
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.
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). Hopefully gRPC support for App Service makes it quickly to Public Review and/or 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.